rusackas commented on code in PR #42895:
URL: https://github.com/apache/superset/pull/42895#discussion_r3761912943
##########
superset/mcp_service/chart/chart_utils.py:
##########
@@ -610,12 +610,19 @@ def create_metric_object(col: ColumnRef) -> Dict[str,
Any] | str:
"MIN",
"MAX",
"COUNT_DISTINCT",
- "STDDEV",
- "VAR",
+ "STDDEV_SAMP",
+ "VAR_SAMP",
"MEDIAN",
"PERCENTILE",
}
Review Comment:
Same as the PERCENTILE thread on schemas.py, this predates the PR and the
SIP doc calls it out as unimplemented and out of scope here. Not touching it in
this diff.
##########
superset/db_engine_specs/mysql.py:
##########
@@ -90,6 +92,17 @@ class MySQLEngineSpec(BasicParametersMixin, BaseEngineSpec):
supports_dynamic_schema = True
supports_multivalues_insert = True
+ # Verified against a live mysql:8.0 instance, including under GROUP BY ...
+ # WITH ROLLUP. `STDDEV_SAMP`/`VAR_SAMP` are native, correct sample
+ # statistics. MEDIAN is deliberately absent: MySQL has neither a `MEDIAN`
+ # function nor `PERCENTILE_CONT` (confirmed: both error). Its `VARIANCE()`
+ # function is population variance, not sample variance, so it is not a
+ # valid stand-in for VAR_SAMP either.
+ _extended_aggregations: dict[str, Callable[[ColumnElement],
ColumnElement]] = {
+ "STDDEV_SAMP": sa.func.stddev_samp,
+ "VAR_SAMP": sa.func.var_samp,
+ }
Review Comment:
MariaDB and Aurora MySQL inherit from MySQLEngineSpec by design, same story
as Redshift inheriting from Postgres a few lines up in postgres.py, they're
SQL-compatible forks, not unrelated engines that happen to share a base class.
That's a different case from Vertica/Snowflake/etc, which is what the prior
commit actually fixed. I don't think this needs a {} override, though happy to
add one if someone hits a real incompatibility on MariaDB.
##########
UPDATING.md:
##########
@@ -26,6 +26,20 @@ assists people when migrating to a new version.
- [42393](https://github.com/apache/superset/pull/42393): Exported dataset
YAML now carries a `uuid` for each metric and column so that custom folder
assignments (which reference metrics/columns by UUID) survive an import into
another workspace. This affects any export bundle that contains datasets, not
just a dataset export: chart, dashboard, database and full-asset exports all
embed the same dataset YAML, so a dashboard exported from this release also
fails to import into an older one even though no dataset was exported directly.
As with `folders` and `currency_code_column`, the affected `datasets/` files
fail schema validation (`Unknown field: uuid`) when imported into Superset
releases that predate this change; regenerate or hand-edit exports for older
targets in mixed-version fleets.
+### New metric aggregates: MEDIAN, Sample Standard Deviation, Sample Variance
+
+`MEDIAN`, `STDDEV_SAMP`, and `VAR_SAMP` are now available anywhere a metric
+aggregate is chosen (every chart type, SQL Lab, MCP), not only in Pivot
+Table's controls. Support is opt-in per database engine, verified against a
+live instance before being enabled: Postgres, MySQL (`STDDEV_SAMP`/`VAR_SAMP`
+only, no `MEDIAN`), DuckDB, and Redshift (inherits Postgres's support, not yet
+separately verified) ship enabled in this release. Picking one of these
Review Comment:
Fair point, MariaDB/Aurora/TimescaleDB inherit this too since they subclass
MySQLEngineSpec/PostgresBaseEngineSpec, same as Redshift. Clarified the wording
in ff7d627.
--
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]