Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: rm single_distinct_to_groupby optimizer pass #15099

Conversation

qazxcdswe123
Copy link
Contributor

See #14586 (comment) for benchmark and context

Which issue does this PR close?

Rationale for this change

This pass is no longer useful according to benchmark and may even slow down planning speed.

What changes are included in this PR?

  • removed single_distinct_to_groupby optimizer pass

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions bot added the optimizer Optimizer rules label Mar 8, 2025
@@ -240,7 +239,6 @@ impl Optimizer {
// Filters can't be pushed down past Limits, we should do PushDownFilter after PushDownLimit
Arc::new(PushDownLimit::new()),
Arc::new(PushDownFilter::new()),
Arc::new(SingleDistinctToGroupBy::new()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Queries like avg(distinct a) rely on this rule, and without it, they cannot be executed anymore.

The following query is available on the main branch, but not on this PR branch.

DataFusion CLI v46.0.0
> select avg(distinct a) from values(1) t(a);
Execution error: avg(DISTINCT) aggregations are not available

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
optimizer Optimizer rules
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants