-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add ROLLUP and GROUPING SETS substrait support #7382
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this @nseekhao
async fn aggregate_grouping_rollup() -> Result<()> { | ||
assert_expected_plan( | ||
"SELECT a, c, e, avg(b) FROM data GROUP BY ROLLUP (a, c, e)", | ||
"Aggregate: groupBy=[[GROUPING SETS ((data.a, data.c, data.e), (data.a, data.c), (data.a), ())]], aggr=[[AVG(data.b)]]\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
for i in 0..set.len() { | ||
sets.push(set[..=i].to_vec()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great. It generates the same result (after .rev()
) with create_rollup_physical_expr
I merged this branch up from `main to resolve a conflict. I hope to merge it when CI completes |
Which issue does this PR close?
Closes #7381 .
Rationale for this change
To add support for aggregation with
ROLLUP
andGROUPING SETS
.What changes are included in this PR?
Expr::GroupingSet
tosubstrait::proto::aggregate_rel::Grouping
Rollup
gets expanded into equivalent grouping sets, since Substrait doesn't have a dedicated type forROLLUP
Cube
is not yet supportedsubstrait::proto::aggregate_rel::Grouping
toExpr::GroupingSet
Are these changes tested?
Yes.
Are there any user-facing changes?
No.
No.