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: Implement grouping function using grouping id #12704

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

eejbyfeldt
Copy link
Contributor

@eejbyfeldt eejbyfeldt commented Oct 1, 2024

Which issue does this PR close?

Closes #5647 .

Rationale for this change

Grouping function is supported by postgres and needed inorder to be able to run TPC-DS (#4763).

What changes are included in this PR?

This PR adds an analyzer rule that will transform the grouping aggregation function into a projection on top of grouping id (added in #12571). Since the grouping aggregation function is so specific and special (and not really a aggregation), I don't think it make sense to generalize the UDAF api to support it.

This PR currently leaves the non-functional grouping UDAF. But since it non functional and will remain so, we might want to replace it with some built in Expr::Grouping instead. Would love some more feedback if that should be done in this PR or some other alternative.

Are these changes tested?

New slt, mostly copied from #10208 with some additional test of wrong arguments.

Are there any user-facing changes?

Yes, after this grouping function will be usable.

@github-actions github-actions bot added logical-expr Logical plan and expressions physical-expr Physical Expressions optimizer Optimizer rules core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) substrait functions labels Oct 1, 2024
@eejbyfeldt eejbyfeldt force-pushed the implement-grouping-function-using-grouping-id branch from 6b6bf52 to b67aee9 Compare October 1, 2024 20:27
@eejbyfeldt eejbyfeldt force-pushed the implement-grouping-function-using-grouping-id branch from b67aee9 to be38977 Compare October 7, 2024 18:08
@github-actions github-actions bot removed logical-expr Logical plan and expressions physical-expr Physical Expressions core Core DataFusion crate substrait labels Oct 7, 2024
This patch adds a Analyzer rule to transform the grouping aggreation
function into computation ontop of the grouping id that is used
internally for grouping sets.
@eejbyfeldt eejbyfeldt force-pushed the implement-grouping-function-using-grouping-id branch from be38977 to bb53649 Compare October 7, 2024 18:19
@eejbyfeldt eejbyfeldt marked this pull request as ready for review October 8, 2024 18:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
functions optimizer Optimizer rules sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Grouping functions with Group By CUBE/ROLLUP/GROUPING SETS
1 participant