You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "aminghadersohi (via GitHub)" <gi...@apache.org> on 2026/09/28 06:48:58 UTC
[PR] fix(mcp): align histogram and waterfall query contracts [superset]
aminghadersohi opened a new pull request, #44744:
URL: https://github.com/apache/superset/pull/44744
### SUMMARY
Align MCP chart queries with the frontend contracts:
- Histogram selects observations and grouping columns and applies the histogram post-processing operator, including HAVING support. Previously generation failed with `Empty query?`.
- Waterfall retains and orders its category and breakdown columns instead of returning only a grand total.
- Histogram Vega-Lite previews render the computed bins/counts rather than treating bin counts as raw observations.
- Treemap discovery examples use the object-shaped column/metric references required by the advertised JSON Schema.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
No UI change. Live MCP checks previously failed Histogram generation and returned only `SUM(revenue)` for Waterfall; the corrected queries return histogram bins and per-category Waterfall rows. Both saved and unsaved Histogram previews use the same binned representation.
### TESTING INSTRUCTIONS
- Query/schema regressions: 7 failing cases before the fix; preview regression: 1 failing case before the fix.
- Focused helper, discovery, and preview tests: 159 passed after the fix.
- `pre-commit run` passed on all seven changed files, including mypy and pylint.
- Live streamable-HTTP MCP checks against a local Superset instance and real SQLite data: generate/save, update, compile/unsaved preview, URL/ASCII/table/Vega-Lite preview, JSON data, SQL, CSV and Excel exports, and discovery for Histogram, Waterfall, Bubble, Treemap, Gauge, and Gantt.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "aminghadersohi (via GitHub)" <gi...@apache.org>.
aminghadersohi commented on PR #44744:
URL: https://github.com/apache/superset/pull/44744#issuecomment-5865011632
Additional live payload inspection caught misleading previews: Sankey and Radar silently became scatter plots, and Funnel fell through to scatter/unbound encodings. The follow-up commit adds explicit UnsupportedFormat for geometries the Vega-Lite adapter does not implement (native Explore and data previews remain supported), and shared stage/metric-bound Funnel bars. Three new regressions fail before and pass after the change. Changed-file pre-commit passed including mypy and pylint. Final live replays and chart-suite rerun are underway; no contributor branches were modified.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #44744:
URL: https://github.com/apache/superset/pull/44744#discussion_r4122625008
##########
superset/mcp_service/chart/chart_helpers.py:
##########
@@ -767,14 +767,63 @@ def _build_single_query_dict(
return qd
-def _build_gantt_or_big_number_query_dicts(
+def _build_specialized_query_dicts(
form_data: dict[str, Any],
viz_type: str,
metrics: list[Any],
row_limit: int | None,
order_desc: bool | None,
) -> list[dict[str, Any]] | None:
- """Build query dictionaries for the two specialized MCP chart contracts."""
+ """Build query dictionaries matching specialized frontend chart contracts."""
+ if viz_type == "histogram_v2":
+ column = form_data["column"]
+ groupby = form_data.get("groupby") or []
+ histogram_metrics = (
+ [
+ {
+ "expressionType": "SQL",
+ "sqlExpression": "COUNT(*)",
+ "label": "COUNT(*)",
+ }
+ ]
+ if form_data.get("having")
+ else []
+ )
+ query = _build_single_query_dict(
+ form_data, [*groupby, column], histogram_metrics, row_limit=row_limit
+ )
+ query["post_processing"] = [
+ {
+ "operation": "histogram",
+ "options": {
+ "column": get_column_name(column),
+ "groupby": [get_column_name(group) for group in groupby],
+ "bins": int(form_data.get("bins", 5)),
+ "normalize": form_data.get("normalize", False),
+ "cumulative": form_data.get("cumulative", False),
+ },
+ }
+ ]
+ return [query]
+
+ if viz_type == "waterfall":
+ axis = form_data.get("x_axis") or form_data.get("granularity_sqla")
+ columns = list(axis) if isinstance(axis, list) else [axis] if axis else []
+ columns.extend(form_data.get("groupby") or [])
+ query = _build_single_query_dict(
+ form_data, columns, metrics, row_limit=row_limit
+ )
+ query["orderby"] = [(column, True) for column in columns]
+ # Bind the time grain to the SQL time column, as extractExtras does.
+ granularity = form_data.get("granularity", form_data.get("granularity_sqla"))
+ if granularity is not None:
+ query["granularity"] = granularity
+ if form_data.get("time_grain_sqla") is not None:
+ query.setdefault("extras", {})["time_grain_sqla"] = form_data[
+ "time_grain_sqla"
+ ]
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>duplicated temporal binding</b></div>
<div id="fix">
The granularity fallback (`form_data.get("granularity", form_data.get("granularity_sqla"))`) and `extras["time_grain_sqla"]` binding here duplicate `_apply_treemap_query_fields` (lines 714-716) and the deck.gl path (lines 959-960). Three copies of the same temporal-binding rule will drift if precedence or extras handling changes. Consider a shared `_bind_time_grain(query, form_data)` helper.
</div>
</div>
<small><i>Code Review Run #b1e383</i></small>
</div>
---
Should Bito avoid suggestions like this for future reviews? (<a href=https://alpha.bito.ai/home/ai-agents/review-rules>Manage Rules</a>)
- [ ] Yes, avoid them
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #44744:
URL: https://github.com/apache/superset/pull/44744#issuecomment-5919823204
**Bito Automatic Review Skipped โ PR Already Merged**<br/><br/>Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.<br/>No action is needed if you didn't intend to review it. To get a review, you can type `/review` in a comment and save it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "aminghadersohi (via GitHub)" <gi...@apache.org>.
aminghadersohi commented on PR #44744:
URL: https://github.com/apache/superset/pull/44744#issuecomment-5864959022
Additional validation completed: the full MCP chart unit-test directory passes (2164 passed, 3 skipped). Live streamable-HTTP MCP checks also verify per-category Waterfall data and Histogram Vega-Lite bin/value encoding, in addition to saved/unsaved generation, updates, data, SQL, CSV/Excel, and discovery. Exact tested commit: a90eb91007d6c67430e7d02a94fd88c3c4d32411.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on code in PR #44744:
URL: https://github.com/apache/superset/pull/44744#discussion_r4123745309
##########
superset/mcp_service/chart/chart_helpers.py:
##########
@@ -767,14 +767,63 @@ def _build_single_query_dict(
return qd
-def _build_gantt_or_big_number_query_dicts(
+def _build_specialized_query_dicts(
form_data: dict[str, Any],
viz_type: str,
metrics: list[Any],
row_limit: int | None,
order_desc: bool | None,
) -> list[dict[str, Any]] | None:
- """Build query dictionaries for the two specialized MCP chart contracts."""
+ """Build query dictionaries matching specialized frontend chart contracts."""
+ if viz_type == "histogram_v2":
+ column = form_data["column"]
+ groupby = form_data.get("groupby") or []
+ histogram_metrics = (
+ [
+ {
+ "expressionType": "SQL",
+ "sqlExpression": "COUNT(*)",
+ "label": "COUNT(*)",
+ }
+ ]
+ if form_data.get("having")
+ else []
+ )
+ query = _build_single_query_dict(
+ form_data, [*groupby, column], histogram_metrics, row_limit=row_limit
+ )
+ query["post_processing"] = [
+ {
+ "operation": "histogram",
+ "options": {
+ "column": get_column_name(column),
+ "groupby": [get_column_name(group) for group in groupby],
+ "bins": int(form_data.get("bins", 5)),
+ "normalize": form_data.get("normalize", False),
+ "cumulative": form_data.get("cumulative", False),
+ },
+ }
+ ]
+ return [query]
+
+ if viz_type == "waterfall":
+ axis = form_data.get("x_axis") or form_data.get("granularity_sqla")
+ columns = list(axis) if isinstance(axis, list) else [axis] if axis else []
+ columns.extend(form_data.get("groupby") or [])
+ query = _build_single_query_dict(
+ form_data, columns, metrics, row_limit=row_limit
+ )
+ query["orderby"] = [(column, True) for column in columns]
+ # Bind the time grain to the SQL time column, as extractExtras does.
+ granularity = form_data.get("granularity", form_data.get("granularity_sqla"))
+ if granularity is not None:
+ query["granularity"] = granularity
+ if form_data.get("time_grain_sqla") is not None:
+ query.setdefault("extras", {})["time_grain_sqla"] = form_data[
+ "time_grain_sqla"
+ ]
Review Comment:
<!-- Bito Reply -->
The reviewer's suggestion to consolidate temporal binding logic is noted, but as you identified, the three locations (Treemap, Waterfall, and deck.gl) operate under distinct conditions, precedence rules, and extras handling. Introducing a shared helper would require complex conditional logic that does not currently offer a clear maintainability or behavioral benefit. Maintaining the existing chart-specific contracts is a reasonable approach given these differences.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #44744:
URL: https://github.com/apache/superset/pull/44744#discussion_r4119354957
##########
superset/mcp_service/chart/chart_helpers.py:
##########
@@ -767,14 +767,55 @@ def _build_single_query_dict(
return qd
-def _build_gantt_or_big_number_query_dicts(
+def _build_specialized_query_dicts(
form_data: dict[str, Any],
viz_type: str,
metrics: list[Any],
row_limit: int | None,
order_desc: bool | None,
) -> list[dict[str, Any]] | None:
- """Build query dictionaries for the two specialized MCP chart contracts."""
+ """Build query dictionaries matching specialized frontend chart contracts."""
+ if viz_type == "histogram_v2":
+ column = form_data["column"]
+ groupby = form_data.get("groupby") or []
+ histogram_metrics = (
+ [
+ {
+ "expressionType": "SQL",
+ "sqlExpression": "COUNT(*)",
+ "label": "COUNT(*)",
+ }
+ ]
+ if form_data.get("having")
+ else []
+ )
+ query = _build_single_query_dict(
+ form_data, [*groupby, column], histogram_metrics, row_limit=row_limit
+ )
+ query["post_processing"] = [
+ {
+ "operation": "histogram",
+ "options": {
+ "column": get_column_name(column),
+ "groupby": [get_column_name(group) for group in groupby],
+ "bins": int(form_data.get("bins", 5)),
+ "normalize": form_data.get("normalize", False),
+ "cumulative": form_data.get("cumulative", False),
+ },
+ }
+ ]
+ return [query]
+
+ if viz_type == "waterfall":
+ axis = form_data.get("x_axis") or form_data.get("granularity_sqla")
Review Comment:
**Suggestion:** Temporal waterfall form data includes `granularity_sqla`, but this branch only selects `x_axis` and never emits query granularity, so time-grain charts aggregate raw timestamps instead of periods.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Sometimes` ยท ๐ท๏ธ `Api mismatch`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill) [](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=7c877aac9f5543a990cd7af8599aa548&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset) [](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt_id=7c877aac9f5543a990cd7af8599aa548&service=github&base_url=https%3A%2F%2Fgithub.com&org=apache&repo=apache%2Fsuperset)
<details>
<summary><b>Prompt for AI Agent ๐ค </b></summary>
```mdx
This is a comment left during a code review.
**Path:** superset/mcp_service/chart/chart_helpers.py
**Line:** 810:810
**Comment:**
*Api Mismatch: Temporal waterfall form data includes `granularity_sqla`, but this branch only selects `x_axis` and never emits query granularity, so time-grain charts aggregate raw timestamps instead of periods.
Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
```
</details>
<a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44744&comment_hash=3f0d2f5bc4c92fbb7af330a5da68f1dc0662623fcb25f4cddecfc8eae2b1d40c&reaction=like'>๐</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44744&comment_hash=3f0d2f5bc4c92fbb7af330a5da68f1dc0662623fcb25f4cddecfc8eae2b1d40c&reaction=dislike'>๐</a>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "aminghadersohi (via GitHub)" <gi...@apache.org>.
aminghadersohi merged PR #44744:
URL: https://github.com/apache/superset/pull/44744
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #44744:
URL: https://github.com/apache/superset/pull/44744#issuecomment-5867925683
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers an incremental AI Review.
- `/review full` - Manually triggers a full AI Review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #44744:
URL: https://github.com/apache/superset/pull/44744#issuecomment-5864989986
<!-- Bito Reply -->
The flagged issue is correct. In `superset/mcp_service/chart/chart_helpers.py`, the `waterfall` query builder logic only extracts `x_axis` or `granularity_sqla` as a single column, failing to include the time grain information required for proper temporal aggregation.
To resolve this, you should update the `waterfall` logic to include the time grain if it is present in the form data. Here is the corrected implementation for that block:
```python
if viz_type == "waterfall":
axis = form_data.get("x_axis") or form_data.get("granularity_sqla")
time_grain = form_data.get("time_grain_sqla")
columns = list(axis) if isinstance(axis, list) else [axis] if axis else []
if time_grain:
columns.append(time_grain)
columns.extend(form_data.get("groupby") or [])
query = _build_single_query_dict(
form_data, columns, metrics, row_limit=row_limit
)
query["orderby"] = [(column, True) for column in columns]
return [query]
```
Would you like me to fetch all other comments on this PR to validate and implement fixes for them as well?
**superset/mcp_service/chart/chart_helpers.py**
```
if viz_type == "waterfall":
axis = form_data.get("x_axis") or form_data.get("granularity_sqla")
time_grain = form_data.get("time_grain_sqla")
columns = list(axis) if isinstance(axis, list) else [axis] if axis else []
if time_grain:
columns.append(time_grain)
columns.extend(form_data.get("groupby") or [])
query = _build_single_query_dict(
form_data, columns, metrics, row_limit=row_limit
)
query["orderby"] = [(column, True) for column in columns]
return [query]
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "aminghadersohi (via GitHub)" <gi...@apache.org>.
aminghadersohi commented on code in PR #44744:
URL: https://github.com/apache/superset/pull/44744#discussion_r4123742475
##########
superset/mcp_service/chart/chart_helpers.py:
##########
@@ -767,14 +767,63 @@ def _build_single_query_dict(
return qd
-def _build_gantt_or_big_number_query_dicts(
+def _build_specialized_query_dicts(
form_data: dict[str, Any],
viz_type: str,
metrics: list[Any],
row_limit: int | None,
order_desc: bool | None,
) -> list[dict[str, Any]] | None:
- """Build query dictionaries for the two specialized MCP chart contracts."""
+ """Build query dictionaries matching specialized frontend chart contracts."""
+ if viz_type == "histogram_v2":
+ column = form_data["column"]
+ groupby = form_data.get("groupby") or []
+ histogram_metrics = (
+ [
+ {
+ "expressionType": "SQL",
+ "sqlExpression": "COUNT(*)",
+ "label": "COUNT(*)",
+ }
+ ]
+ if form_data.get("having")
+ else []
+ )
+ query = _build_single_query_dict(
+ form_data, [*groupby, column], histogram_metrics, row_limit=row_limit
+ )
+ query["post_processing"] = [
+ {
+ "operation": "histogram",
+ "options": {
+ "column": get_column_name(column),
+ "groupby": [get_column_name(group) for group in groupby],
+ "bins": int(form_data.get("bins", 5)),
+ "normalize": form_data.get("normalize", False),
+ "cumulative": form_data.get("cumulative", False),
+ },
+ }
+ ]
+ return [query]
+
+ if viz_type == "waterfall":
+ axis = form_data.get("x_axis") or form_data.get("granularity_sqla")
+ columns = list(axis) if isinstance(axis, list) else [axis] if axis else []
+ columns.extend(form_data.get("groupby") or [])
+ query = _build_single_query_dict(
+ form_data, columns, metrics, row_limit=row_limit
+ )
+ query["orderby"] = [(column, True) for column in columns]
+ # Bind the time grain to the SQL time column, as extractExtras does.
+ granularity = form_data.get("granularity", form_data.get("granularity_sqla"))
+ if granularity is not None:
+ query["granularity"] = granularity
+ if form_data.get("time_grain_sqla") is not None:
+ query.setdefault("extras", {})["time_grain_sqla"] = form_data[
+ "time_grain_sqla"
+ ]
Review Comment:
Reviewed at e7c2e45c2e765e266a98606c3deb9d427be7b525. Not applicable as a correctness fix: these are not three copies of the same temporal-binding rule.
* `chart_helpers.py:704-716, 769-771`: Treemap binds only granularity, before shared filter/extras processing. Shared processing applies the top-level grain and then merges saved extras (`:330-351`).
* `chart_helpers.py:813-824`: Waterfall binds after that shared processing and explicitly reapplies a non-null top-level grain. Moving this into Treemap's position would change extras precedence.
* `chart_helpers.py:899-902, 955-960`: deck.gl binds only for the listed time-series chart types and a truthy grain, sets `is_timeseries`, and reads `granularity_sqla` directly rather than the normalized-granularity fallback. The proposed identical-rule path does not occur here.
The small granularity expression is shared text, but a common helper covering all three would require preserving these different conditions and ordering; no failing behavioral case is identified by this maintainability suggestion. Keeping the chart-specific contracts rather than introducing that refactor in this fix.
Validation: `test_chart_helpers.py` and `test_treemap_completeness.py`: 244 passed, 2 skipped. `pre-commit run --files` on the helper and those two tests: all applicable hooks passed. No source changes or push.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #44744:
URL: https://github.com/apache/superset/pull/44744#issuecomment-5870590437
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers an incremental AI Review.
- `/review full` - Manually triggers a full AI Review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #44744:
URL: https://github.com/apache/superset/pull/44744#issuecomment-5864915301
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #44744:
URL: https://github.com/apache/superset/pull/44744#issuecomment-5865243061
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/44744?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:x: Patch coverage is `10.63830%` with `42 lines` in your changes missing coverage. Please review.
:white_check_mark: Project coverage is 66.00%. Comparing base ([`ffe9a00`](https://app.codecov.io/gh/apache/superset/commit/ffe9a00fc42635287310eab08ad664c00759c4fc?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`70dd1a3`](https://app.codecov.io/gh/apache/superset/commit/70dd1a3f035b225cd14f4999854e09aa0b558fe1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
| [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/44744?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [superset/mcp\_service/chart/preview\_utils.py](https://app.codecov.io/gh/apache/superset/pull/44744?src=pr&el=tree&filepath=superset%2Fmcp_service%2Fchart%2Fpreview_utils.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWNwX3NlcnZpY2UvY2hhcnQvcHJldmlld191dGlscy5weQ==) | 12.50% | [21 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/44744?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [superset/mcp\_service/chart/chart\_helpers.py](https://app.codecov.io/gh/apache/superset/pull/44744?src=pr&el=tree&filepath=superset%2Fmcp_service%2Fchart%2Fchart_helpers.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWNwX3NlcnZpY2UvY2hhcnQvY2hhcnRfaGVscGVycy5weQ==) | 11.76% | [15 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/44744?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...perset/mcp\_service/chart/tool/get\_chart\_preview.py](https://app.codecov.io/gh/apache/superset/pull/44744?src=pr&el=tree&filepath=superset%2Fmcp_service%2Fchart%2Ftool%2Fget_chart_preview.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvbWNwX3NlcnZpY2UvY2hhcnQvdG9vbC9nZXRfY2hhcnRfcHJldmlldy5weQ==) | 0.00% | [6 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/44744?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
> :exclamation: There is a different number of reports uploaded between BASE (ffe9a00) and HEAD (70dd1a3). Click for more details.
>
> <details><summary>HEAD has 26 uploads less than BASE</summary>
>
>| Flag | BASE (ffe9a00) | HEAD (70dd1a3) |
>|------|------|------|
>|python|21|3|
>|presto|4|1|
>|hive|4|1|
>|sqlite|3|1|
></details>
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #44744 +/- ##
===========================================
- Coverage 81.22% 66.00% -15.22%
===========================================
Files 2968 2968
Lines 179363 179407 +44
Branches 41597 41607 +10
===========================================
- Hits 145681 118416 -27265
- Misses 30971 58408 +27437
+ Partials 2711 2583 -128
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/44744/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage ฮ | |
|---|---|---|
| [hive](https://app.codecov.io/gh/apache/superset/pull/44744/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `36.72% <10.63%> (-0.02%)` | :arrow_down: |
| [mysql](https://app.codecov.io/gh/apache/superset/pull/44744/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [postgres](https://app.codecov.io/gh/apache/superset/pull/44744/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
| [presto](https://app.codecov.io/gh/apache/superset/pull/44744/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `38.62% <10.63%> (-0.02%)` | :arrow_down: |
| [python](https://app.codecov.io/gh/apache/superset/pull/44744/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `55.89% <10.63%> (-29.59%)` | :arrow_down: |
| [sqlite](https://app.codecov.io/gh/apache/superset/pull/44744/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `55.76% <10.63%> (-0.03%)` | :arrow_down: |
| [unit](https://app.codecov.io/gh/apache/superset/pull/44744/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/44744?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #44744:
URL: https://github.com/apache/superset/pull/44744#issuecomment-5867824985
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**Commands**
Type the following command in the pull request comment and save the comment.
- `/review` - Manually triggers an incremental AI Review.
- `/review full` - Manually triggers a full AI Review.
- `/pause` - Pauses automatic reviews on this pull request.
- `/resume` - Resumes automatic reviews.
- `/resolve` - Marks all Bito-posted review comments as resolved.
- `/abort` - Cancels all in-progress reviews.
Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(mcp): align histogram and waterfall query contracts [superset]
Posted by "aminghadersohi (via GitHub)" <gi...@apache.org>.
aminghadersohi commented on code in PR #44744:
URL: https://github.com/apache/superset/pull/44744#discussion_r4120928577
##########
superset/mcp_service/chart/chart_helpers.py:
##########
@@ -767,14 +767,55 @@ def _build_single_query_dict(
return qd
-def _build_gantt_or_big_number_query_dicts(
+def _build_specialized_query_dicts(
form_data: dict[str, Any],
viz_type: str,
metrics: list[Any],
row_limit: int | None,
order_desc: bool | None,
) -> list[dict[str, Any]] | None:
- """Build query dictionaries for the two specialized MCP chart contracts."""
+ """Build query dictionaries matching specialized frontend chart contracts."""
+ if viz_type == "histogram_v2":
+ column = form_data["column"]
+ groupby = form_data.get("groupby") or []
+ histogram_metrics = (
+ [
+ {
+ "expressionType": "SQL",
+ "sqlExpression": "COUNT(*)",
+ "label": "COUNT(*)",
+ }
+ ]
+ if form_data.get("having")
+ else []
+ )
+ query = _build_single_query_dict(
+ form_data, [*groupby, column], histogram_metrics, row_limit=row_limit
+ )
+ query["post_processing"] = [
+ {
+ "operation": "histogram",
+ "options": {
+ "column": get_column_name(column),
+ "groupby": [get_column_name(group) for group in groupby],
+ "bins": int(form_data.get("bins", 5)),
+ "normalize": form_data.get("normalize", False),
+ "cumulative": form_data.get("cumulative", False),
+ },
+ }
+ ]
+ return [query]
+
+ if viz_type == "waterfall":
+ axis = form_data.get("x_axis") or form_data.get("granularity_sqla")
Review Comment:
Valid; fixed in e7c2e45c2e. Selecting the axis was not sufficient: the specialized Waterfall query omitted both the granularity binding and the time grain in extras. The query now carries both, matching Waterfall buildQuery/extractExtras. The regression test uses map_waterfall_config and covers modern/legacy axes with and without a monthly grain: three cases fail on the previous head and all four pass with the fix. The helper/Waterfall suites pass (131 tests), compile/preview suites pass (60 tests), and pre-commit passes including mypy and pylint.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org