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