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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to