bito-code-review[bot] commented on code in PR #43567:
URL: https://github.com/apache/superset/pull/43567#discussion_r4163561191
##########
superset/mcp_service/chart/schemas.py:
##########
@@ -1727,6 +1727,60 @@ def record_implicit_metric_aggregate(self) ->
"BubbleChartConfig":
return self
+class FunnelChartConfig(BaseChartConfig):
+ """Config for funnel charts (viz_type ``funnel``).
+
+ Matches the frontend Funnel buildQuery contract: a single ``groupby``
+ dimension whose values become the funnel stages and one ``metric`` sizing
+ each stage. When ``sort_by_metric`` is set the query orders stages by the
+ metric descending (largest stage first).
+ """
+
+ model_config = ConfigDict(extra="ignore", populate_by_name=True)
+
+ chart_type: Literal["funnel"] = "funnel"
+ dimension: ColumnRef = Field(
+ ...,
+ description="Category column whose values become the funnel stages",
+ validation_alias=AliasChoices("dimension", "groupby"),
+ )
+ metric: ColumnRef = Field(
+ ...,
+ description="Value metric sizing each stage (use aggregate e.g. SUM, "
+ "COUNT for ad-hoc, or set saved_metric=True for a saved dataset
metric)",
Review Comment:
<div>
<div id="suggestion">
<div id="issue"><b>Metric SUM default unvalidated</b></div>
<div id="fix">
A bare `metric` (no aggregate/saved_metric/sql_expression) is silently
summed by `create_metric_object` (chart_utils.py), but
`DatasetValidator._validate_aggregations` skips refs without `aggregate`
(dataset_validator.py:785), so SUM(text) reaches the DB on Tier-2-skipping
paths. `BubbleChartConfig.record_implicit_metric_aggregate` guards exactly
this; add the same recording here.
</div>
</div>
<small><i>Code Review Run #826fad</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: [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]