You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support complete distinct usage for aggregate expressions #2406
Is your feature request related to a problem or challenge? Please describe what you are trying to do.
Here are multiple aggregate expressions have not support distinct usage yet.
Though optimizer SingleDistinctToGroupBy (#1315) supports single distinct usage, there are more SQL scenes have not been covered, like
SELECT AVG(c1), SUM(DISTINCT c2) FROM test
I would like to take effort to work on the following tickets to complete distinct usage for aggregate expressions
"APPROX_MEDIAN(DISTINCT) aggregations are not available"
);
}
May be missing support
These functions don't explicitly use the distinct flag to handle distinct specific behaviour, but depending on their semantics maybe distinct doesn't make sense for them? Anyway just listing them:
Activity
WinkerDu commentedon May 2, 2022
@andygrove @alamb can you please assign this issue to me? Thank you ❤️
alamb commentedon May 2, 2022
Done -- thanks @WinkerDu
Refactor distinct aggregate implementations to use common buffer (#18348
Dandandan commentedon Jun 1, 2026
All done
Jefffrey commentedon Jun 1, 2026
I think there's still some that weren't listed here that still don't support distinct.
Explicitly denies
stddev
datafusion/datafusion/functions-aggregate/src/stddev.rs
Lines 118 to 123 in bb121a8
approx_median
datafusion/datafusion/functions-aggregate/src/approx_median.rs
Lines 130 to 135 in bb121a8
May be missing support
These functions don't explicitly use the
distinctflag to handle distinct specific behaviour, but depending on their semantics maybe distinct doesn't make sense for them? Anyway just listing them: