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
corr, covar_pop, covar_samp and regr_* silently ignore DISTINCT #26471
corr, covar_pop, covar_samp and the regr_* functions return the same result with DISTINCT as without it. The planner accepts the query, but the accumulators never read is_distinct.
To Reproduce
SELECT regr_count(x, y) AS rc,
regr_count(DISTINCT x, y) AS rc_d,
covar_pop(x, y) AS cv,
covar_pop(DISTINCT x, y) AS cv_d
FROM (VALUES (1.0, 1.0), (1.0, 1.0), (2.0, 3.0)) t(x, y);
DISTINCT applies to the argument tuple: rc_d = 2, cv_d = 0.5. DuckDB returns these values. If DataFusion does not support it, the query should fail with a clear error instead of returning the non-distinct answer.
I couldn't find an issue tracking that follow-up. Both options look reasonable: reject f(DISTINCT ..) at planning time when the function reports Unsupported, or deduplicate the input for it. Rejecting is the smaller change, and it's at least correct.
Related: #25374 and #25375 (forwarding distinct_handling).
Activity
abp002 commentedon Oct 18, 2026
take
fix: reject DISTINCT in corr, covar and regr_* instead of ignoring it (…