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

feat(substrait): support order_by in aggregate functions #13114

Merged
merged 1 commit into from
Oct 29, 2024

Conversation

bvolpato
Copy link
Contributor

@bvolpato bvolpato commented Oct 25, 2024

Which issue does this PR close?

Closes #13113.

Rationale for this change

Adding support to a new sort of expression (ORDER BY within aggregation functions) in the Substrait consumer.

For example:

SELECT ARRAY_AGG(genre ORDER BY genre) FROM book

What changes are included in this PR?

The wiring to go from Substrait's SortField to DataFusion's SortExpr in the context of aggregation measurements.

The actual conversion already existed at from_substrait_sorts because of window functions - I just hooked up in the context of aggragations as well.

Are these changes tested?

I added a roundtrip test and also added a logical plan to check if everything was decoded correctly. Open to more ideas on how to better unit test this.

Are there any user-facing changes?

n/a

Copy link
Contributor

@vbarua vbarua left a comment

Choose a reason for hiding this comment

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

Clear improvement with tests ✨

Thanks for fixing this.

@bvolpato bvolpato force-pushed the substrait-aggregate-expr branch 2 times, most recently from 3f11b77 to a44444e Compare October 25, 2024 20:11
Copy link
Member

@andygrove andygrove left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks @bvolpato

@bvolpato
Copy link
Contributor Author

LGTM. Thanks @bvolpato

Thank you! Sorry, I've missed a cargo fmt and we may need to trigger the checks again.

@alamb alamb merged commit d62f262 into apache:main Oct 29, 2024
24 checks passed
@alamb
Copy link
Contributor

alamb commented Oct 29, 2024

Thanks @bvolpato @vbarua and @andygrove

Sorry for the delay in merging this one

@alamb alamb mentioned this pull request Nov 5, 2024
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ORDER BY in Substrait aggregate functions
4 participants