-
Notifications
You must be signed in to change notification settings - Fork 28.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-33308][SQL] Refactor current grouping analytics
### What changes were proposed in this pull request? As discussed in #30145 (comment) #30145 (comment) We need to rewrite current Grouping Analytics grammar to support as flexible as Postgres SQL to support subsequent development. In postgres sql, it support ``` select a, b, c, count(1) from t group by cube (a, b, c); select a, b, c, count(1) from t group by cube(a, b, c); select a, b, c, count(1) from t group by cube (a, b, c, (a, b), (a, b, c)); select a, b, c, count(1) from t group by rollup(a, b, c); select a, b, c, count(1) from t group by rollup (a, b, c); select a, b, c, count(1) from t group by rollup (a, b, c, (a, b), (a, b, c)); ``` In this pr, we have done three things as below, and we will split it to different pr: - Refactor CUBE/ROLLUP (regarding them as ANTLR tokens in a parser) - Refactor GROUPING SETS (the logical node -> a new expr) - Support new syntax for CUBE/ROLLUP (e.g., GROUP BY CUBE ((a, b), (a, c))) ### Why are the changes needed? Rewrite current Grouping Analytics grammar to support as flexible as Postgres SQL to support subsequent development. ### Does this PR introduce _any_ user-facing change? User can write Grouping Analytics grammar as flexible as Postgres SQL to support subsequent development. ### How was this patch tested? Added UT Closes #30212 from AngersZhuuuu/refact-grouping-analytics. Lead-authored-by: angerszhu <angers.zhu@gmail.com> Co-authored-by: Angerszhuuuu <angers.zhu@gmail.com> Co-authored-by: AngersZhuuuu <angers.zhu@gmail.com> Co-authored-by: Takeshi Yamamuro <yamamuro@apache.org> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
- Loading branch information
Showing
15 changed files
with
435 additions
and
257 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.