codeant-ai-for-open-source[bot] commented on code in PR #44684:
URL: https://github.com/apache/superset/pull/44684#discussion_r4110163214
##########
superset/mcp_service/chart/preview_utils.py:
##########
@@ -1257,6 +1257,32 @@ def generate_bubble_vega_lite_preview(
)
+def _resolve_y_metric_column(row: Dict[str, Any], metrics: List[Any]) -> Any:
+ """Pick the y-axis column for a Vega-Lite preview.
+
+ Prefers the first chart metric whose result label is present in the row.
+ Falls back to a name/value heuristic only when no metric label matches.
+ Booleans are never treated as numeric in the fallback.
+ """
+ for metric in metrics:
+ label = metric_result_label(metric)
+ if label is not None and label in row:
Review Comment:
**Suggestion:** A matching metric label is accepted without checking its
value, but the caller always declares it quantitative; string or boolean metric
results therefore produce an invalid Vega-Lite encoding.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Type error`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=d1f4961553c24e4b9cfafe71ec8a49a3&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=d1f4961553c24e4b9cfafe71ec8a49a3&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/preview_utils.py
**Line:** 1267:1269
**Comment:**
*Type Error: A matching metric label is accepted without checking its
value, but the caller always declares it quantitative; string or boolean metric
results therefore produce an invalid Vega-Lite encoding.
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%2F44684&comment_hash=457800f8c6ce6985905e6101b7eb8097f78b3846ddd157f2296ae862c0ec8480&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44684&comment_hash=457800f8c6ce6985905e6101b7eb8097f78b3846ddd157f2296ae862c0ec8480&reaction=dislike'>๐</a>
##########
superset/mcp_service/chart/preview_utils.py:
##########
@@ -1257,6 +1257,32 @@ def generate_bubble_vega_lite_preview(
)
+def _resolve_y_metric_column(row: Dict[str, Any], metrics: List[Any]) -> Any:
+ """Pick the y-axis column for a Vega-Lite preview.
+
+ Prefers the first chart metric whose result label is present in the row.
+ Falls back to a name/value heuristic only when no metric label matches.
+ Booleans are never treated as numeric in the fallback.
+ """
+ for metric in metrics:
+ label = metric_result_label(metric)
+ if label is not None and label in row:
+ return label
+
+ for col in row.keys():
+ # Check if this is a metric column (usually has aggregation in name)
+ if any(
+ agg in str(col).upper()
+ for agg in ["SUM", "AVG", "COUNT", "MIN", "MAX", "TOTAL"]
+ ):
+ return col
Review Comment:
**Suggestion:** The fallback selects any column whose name contains an
aggregation word, so dimensions such as `summary` or `maximum_status` can
become an invalid quantitative Y field.
**Assessment:** ๐ `Major` ยท ๐ `Occurrence: Rarely` ยท ๐ท๏ธ `Incorrect condition
logic`
[](https://docs.codeant.ai/cli/resolve-pr-comments-skill)
[](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt_id=cb689ef34df344d994fa7712376002f9&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=cb689ef34df344d994fa7712376002f9&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/preview_utils.py
**Line:** 1272:1278
**Comment:**
*Incorrect Condition Logic: The fallback selects any column whose name
contains an aggregation word, so dimensions such as `summary` or
`maximum_status` can become an invalid quantitative Y field.
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%2F44684&comment_hash=4b40f76f3a0214b0ecde9109dc9ebd3cab2d709ce0d396ee6f1b0293622c6b66&reaction=like'>๐</a>
| <a
href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F44684&comment_hash=4b40f76f3a0214b0ecde9109dc9ebd3cab2d709ce0d396ee6f1b0293622c6b66&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]