codeant-ai-for-open-source[bot] commented on code in PR #42895:
URL: https://github.com/apache/superset/pull/42895#discussion_r3762410992
##########
superset-frontend/src/explore/constants.ts:
##########
@@ -23,8 +23,11 @@ export const AGGREGATES = {
COUNT: 'COUNT',
COUNT_DISTINCT: 'COUNT_DISTINCT',
MAX: 'MAX',
+ MEDIAN: 'MEDIAN',
MIN: 'MIN',
+ STDDEV_SAMP: 'STDDEV_SAMP',
SUM: 'SUM',
+ VAR_SAMP: 'VAR_SAMP',
};
export const AGGREGATES_OPTIONS = Object.values(AGGREGATES);
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not require engine-specific filtering for aggregate options in this
picker; follow the existing pattern of allowing selection and relying on
backend validation at query time.
**Applied to:**
- `superset-frontend/src/explore/constants.ts`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
##########
superset/utils/core.py:
##########
@@ -1797,7 +1808,9 @@ def get_metric_type_from_column(column: Any, datasource:
Explorable) -> str:
expression: str = metric.expression
match = re.match(
- r"(SUM|AVG|COUNT|COUNT_DISTINCT|MIN|MAX|FIRST|LAST)\((.*)\)",
expression
+ r"(SUM|AVG|COUNT|COUNT_DISTINCT|MIN|MAX|FIRST|LAST"
+ r"|MEDIAN|STDDEV_SAMP|VAR_SAMP)\((.*)\)",
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not require case-insensitivity or whitespace tolerance only for newly
added aggregate functions; preserve the existing aggregate-matching behavior
unless updating all supported aggregates consistently.
**Applied to:**
- `superset/utils/core.py`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
##########
superset/db_engine_specs/postgres.py:
##########
@@ -192,6 +194,18 @@ class PostgresBaseEngineSpec(BaseEngineSpec):
TimeGrain.YEAR: "DATE_TRUNC('year', {col})",
}
+ # Verified against a live postgres:16 instance, including under GROUPING
+ # SETS (the pivot table's non-additive-total rollup pattern): the grand
+ # total correctly reflects every row, not an aggregate-of-aggregates.
+ # Inherited by Redshift (a Postgres fork); its SQL function reference
+ # documents the same PERCENTILE_CONT/STDDEV_SAMP/VAR_SAMP support, but
+ # that has not been separately verified against a live Redshift instance.
+ _extended_aggregations: dict[str, Callable[[ColumnElement],
ColumnElement]] = {
+ "MEDIAN": lambda col: sa.func.percentile_cont(0.5).within_group(col),
+ "STDDEV_SAMP": sa.func.stddev_samp,
+ "VAR_SAMP": sa.func.var_samp,
+ }
Review Comment:
✅ **Customized review instruction saved!**
**Instruction:**
> Do not flag inheritance of PostgreSQL extended aggregations by
Postgres-fork engine specs such as TimescaleDB, Aurora PostgreSQL, and
Redshift; treat them as compatible by design unless a concrete incompatibility
is identified.
**Applied to:**
- `superset/db_engine_specs/postgres.py`
---
💡 *To manage or update this instruction, visit: [CodeAnt AI
Settings](https://app.codeant.ai/org/settings/learnings)*
--
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]