rusackas commented on code in PR #42895:
URL: https://github.com/apache/superset/pull/42895#discussion_r3740370877
##########
superset/mcp_service/chart/validation/runtime/format_validator.py:
##########
@@ -217,7 +217,7 @@ def suggest_format(column: ColumnRef) -> str:
"""Suggest appropriate format based on column and aggregation."""
if column.aggregate in ["COUNT", "COUNT_DISTINCT"]:
return ",d" # Integer with thousands separator
- elif column.aggregate in ["AVG", "STDDEV", "VAR"]:
+ elif column.aggregate in ["AVG", "STDDEV_SAMP", "VAR_SAMP", "STDDEV",
"VAR"]:
Review Comment:
Good catch, added MEDIAN to that branch.
##########
superset/utils/core.py:
##########
@@ -183,6 +183,15 @@ class AdhocMetricExpressionType(StrEnum):
SQL = "SQL"
+# Aggregates with no safe, universal cross-dialect spelling -- unlike
+# SUM/COUNT/AVG/MIN/MAX/COUNT_DISTINCT, whose SQL is generated the same way on
+# every engine. Support for these is opt-in per `BaseEngineSpec` (see
+# `get_extended_aggregation_func`); used to distinguish a genuinely invalid
+# aggregate name from one that is valid but unsupported on the current
database,
+# for a clearer user-facing error.
+EXTENDED_METRIC_AGGREGATES = frozenset({"MEDIAN", "STDDEV_SAMP", "VAR_SAMP"})
Review Comment:
Added STDDEV_SAMP/VAR_SAMP to the parser regex and `METRIC_MAP_TYPE`.
--
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]