kgabryje commented on code in PR #38955:
URL: https://github.com/apache/superset/pull/38955#discussion_r3009891623


##########
superset/mcp_service/chart/chart_utils.py:
##########
@@ -381,8 +381,8 @@ def map_table_config(config: TableChartConfig) -> Dict[str, 
Any]:
     aggregated_metrics = []
 
     for col in config.columns:
-        if col.aggregate:
-            # Column has aggregation - treat as metric
+        if col.saved_metric or col.aggregate:

Review Comment:
   The return type annotation `Dict[str, Any] | str` already protects against 
this — any future caller doing `result["aggregate"]` without a type guard would 
get a mypy error (which is exactly what happened with the existing tests — we 
had to add `assert isinstance(result, dict)` to satisfy mypy). The docstring on 
`create_metric_object` already explains both return paths. I think mypy 
enforcement is a stronger guard than comments at call sites, which can drift.



-- 
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