You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@asterixdb.apache.org by dl...@apache.org on 2021/01/27 01:07:54 UTC

[asterixdb] 08/11: [NO ISSUE][DOC] Document grouping sets syntax

This is an automated email from the ASF dual-hosted git repository.

dlych pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/asterixdb.git

commit 8bcc6d26254bc84eab8f1f08304ccd95582e316a
Author: Dmitry Lychagin <dm...@couchbase.com>
AuthorDate: Mon Jan 25 16:39:18 2021 -0800

    [NO ISSUE][DOC] Document grouping sets syntax
    
    - user model changes: no
    - storage format changes: no
    - interface changes: no
    
    Details:
    - Document grouping sets in group by clause
    
    Change-Id: I28724daf0683c94419d41134c7c967e9958b9e5a
    Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/9726
    Integration-Tests: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Tested-by: Jenkins <je...@fulliautomatix.ics.uci.edu>
    Reviewed-by: Dmitry Lychagin <dm...@couchbase.com>
    Reviewed-by: Ali Alsuliman <al...@gmail.com>
---
 asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf        | 14 ++++++++++++--
 asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md |  8 ++++++++
 2 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf b/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf
index 62d333a..45d7d6e 100644
--- a/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf
+++ b/asterixdb/asterix-doc/src/main/grammar/sqlpp.ebnf
@@ -76,12 +76,22 @@ LetClause ::= "LET" Variable "=" Expr ("," Variable "=" Expr)*
 
 WhereClause ::= "WHERE" Expr
 
-GroupByClause ::= "GROUP BY" Expr ("AS"? Identifier)? ( "," Expr ("AS"? Identifier)?)* GroupAsClause?
+GroupByClause ::= "GROUP BY" GroupingElement ("," GroupingElement)* GroupAsClause?
 
-HavingClause ::= "HAVING" Expr
+GroupingElement ::=  GroupByExprPair
+              | ( "(" GroupByExprPair ( "," GroupByExprPair )* ")")
+              | ( "GROUPING" "SETS" "(" GroupingElement ("," GroupingElement)* ")" )
+              | ( ( "ROLLUP" | "CUBE" ) "(" OrdinaryGroupingSet ( "," OrdinaryGroupingSet )* ")" )
+              | ( "(" ")" )
+
+OrdinaryGroupingSet ::= GroupByExprPair | ( "(" GroupByExprPair ( "," GroupByExprPair )* ")")
+
+GroupByExprPair ::= Expr ("AS"? Identifier)?
 
 GroupAsClause ::= "GROUP AS" Identifier
 
+HavingClause ::= "HAVING" Expr
+
 Selection ::= WithClause? QueryBlock UnionOption* OrderByClause? ( LimitClause | OffsetClause )?
 
 UnionOption ::= "UNION ALL" (QueryBlock | Subquery)
diff --git a/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md b/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
index 17e6339..8076140 100644
--- a/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
+++ b/asterixdb/asterix-doc/src/main/markdown/sqlpp/3_query.md
@@ -652,6 +652,14 @@ Grouping is especially important when manipulating hierarchies like the ones tha
 ### GroupByClause
 **![](../images/diagrams/GroupByClause.png)**
 
+### GroupingElement
+**![](../images/diagrams/GroupingElement.png)**
+
+### OrdinaryGroupingSet
+**![](../images/diagrams/OrdinaryGroupingSet.png)**
+
+### GroupByExprPair
+**![](../images/diagrams/GroupByExprPair.png)**
 
 ---