-
Notifications
You must be signed in to change notification settings - Fork 986
DRILL-3962: Add Support For ROLLUP, CUBE, GROUPING SETS, GROUPING, GROUPING_ID, GROUP_ID #3026
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
Conversation
rymarm
left a comment
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.
Hi @cgivre, I think it would be a good idea to split code from a single method for hundreds of rows into separate helper methods to improve code readability and maintainability. Please check my comments.
The overall change looks good to me, thank you for this!
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/union/UnionAllRecordBatch.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/drill/exec/planner/logical/DrillAggregateExpandGroupingSetsRule.java
Outdated
Show resolved
Hide resolved
...rc/main/java/org/apache/drill/exec/planner/logical/DrillAggregateExpandGroupingSetsRule.java
Show resolved
Hide resolved
|
@rymarm Thanks for the review. I addressed all your comments. |
...rc/main/java/org/apache/drill/exec/planner/logical/DrillAggregateExpandGroupingSetsRule.java
Show resolved
Hide resolved
...rc/main/java/org/apache/drill/exec/planner/logical/DrillAggregateExpandGroupingSetsRule.java
Outdated
Show resolved
Hide resolved
rymarm
left a comment
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.
@cgivre Thank you for all the changes! LGTM +1
|
Thanks @rymarm for the review! |
DRILL-3962: Add Support For ROLLUP, CUBE, GROUPING SETS, GROUPING, GROUPING_ID, GROUP_ID
Description
In recent versions of SQL, there are several aggregates which create different summaries of the aggregate data.
Specifically, this PR adds support for:
GROUPING SETSROLLUPCUBEGROUPING()GROUPING_ID()GROUP_ID()Documentation
GROUPING SETS:
GROUPING SETSallows you to define multiple independent groupings within a singleGROUP BYquery. Instead of writing separate queries for each aggregation, you can specify different column combinations to produce multiple summary results at once. It gives you fine-grained control over which subtotals are calculated.ROLLUP
ROLLUPgenerates hierarchical aggregations that move from detailed data to higher-level summaries. For example, aROLLUPon (year, month, day) produces totals by day, month, year, and an overall grand total. It’s ideal for creating reports with cumulative subtotals.CUBE
CUBEcreates aggregations for all possible combinations of the specified columns. It’s useful for multidimensional analysis, such as computing totals across every dimension and their intersections. This produces the most comprehensive summary of the data.Testing
Created additional unit tests.