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

[Minor]: Produce better plan when group by contains all of the ordering requirements #7542

Merged
merged 3 commits into from
Sep 13, 2023
Merged

[Minor]: Produce better plan when group by contains all of the ordering requirements #7542

merged 3 commits into from
Sep 13, 2023

Conversation

mustafasrepo
Copy link
Contributor

Which issue does this PR close?

Closes #.

Rationale for this change

In the discussion @Dandandan observed that we produce unnecessary Aggregate::Partial/Aggregate::Final stack where Aggregate::Single would work.
This PR fixes this problem.

What changes are included in this PR?

This case arises only when ordering requirement of aggregator is among group by expressions. In these cases we now ignore ordering requirement (since each group will satisfy this requirement definitively.)

Are these changes tested?

Existing tests should work

Are there any user-facing changes?

@github-actions github-actions bot added physical-expr Physical Expressions core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Sep 13, 2023
Copy link
Contributor

@Dandandan Dandandan left a comment

Choose a reason for hiding this comment

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

Looks good, one remaining comment about code style

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

The plans certainly look nicer to me

@Dandandan Dandandan merged commit cde7401 into apache:main Sep 13, 2023
21 checks passed
@andygrove andygrove added the enhancement New feature or request label Oct 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate enhancement New feature or request physical-expr Physical Expressions sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants