AngersZhuuuu commented on a change in pull request #30212:
URL: https://github.com/apache/spark/pull/30212#discussion_r519080503
##########
File path:
sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
##########
@@ -587,13 +587,26 @@ fromClause
;
aggregationClause
- : GROUP BY groupingExpressions+=expression (','
groupingExpressions+=expression)* (
+ : GROUP BY groupingExpressionWithGroupingAnalytics+=groupByClause
+ (',' groupingExpressionWithGroupingAnalytics+=groupByClause)*
+ | GROUP BY groupingExpressions+=expression (','
groupingExpressions+=expression)* (
WITH kind=ROLLUP
| WITH kind=CUBE
| kind=GROUPING SETS '(' groupingSet (',' groupingSet)* ')')?
| GROUP BY kind=GROUPING SETS '(' groupingSet (',' groupingSet)* ')'
;
+groupByClause
+ : groupingAnalytics
+ | expression
+ ;
+
+groupingAnalytics
+ : ROLLUP '(' expression (',' expression)* ')'
+ | CUBE '(' expression (',' expression)* ')'
+ | GROUPING SETS '(' groupingSet (',' groupingSet)* ')'
Review comment:
> Could you file a jira for it and check if the other systems (e.g.,
Oracle, MySQL, ...) support the syntax?
https://issues.apache.org/jira/browse/SPARK-33377
How about:
1. Just remove `cube|rollup` function and move `cube|rollup|groupings sets`
to parser level and don't support composite column in this pr.
2. A new pr of https://issues.apache.org/jira/browse/SPARK-33377 to support
composite column in cube & rollup
3. Pr to replace current `GroupingSets`
https://issues.apache.org/jira/browse/SPARK-33309
4. PR support partial `cube|rollup|grouping` set and all mixed case
https://github.com/apache/spark/pull/30144
5. Then pr support CUBE/ROLLUP/GROUPING SETS use GROUP BY ordinal
https://github.com/apache/spark/pull/30145
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]