cloud-fan commented on a change in pull request #30144:
URL: https://github.com/apache/spark/pull/30144#discussion_r611420882



##########
File path: docs/sql-ref-syntax-qry-select-groupby.md
##########
@@ -93,6 +95,25 @@ aggregate_name ( [ DISTINCT ] expression [ , ... ] ) [ 
FILTER ( WHERE boolean_ex
      (product, warehouse, location), (warehouse), (product), (warehouse, 
product), ())`.
     The N elements of a `CUBE` specification results in 2^N `GROUPING SETS`.
 
+* **Mixed Grouping Analytics**
+
+    A GROUP BY clause can include multiple  `group_expression`s and multiple 
`CUBE|ROLLUP|GROUPING SETS`s.
+    `CUBE|ROLLUP` is just a syntax sugar for `GROUPING SETS`, please refer to 
the sections above for
+    how to translate `CUBE|ROLLUP` to `GROUPING SETS`. `group_expression` can 
be treated as a single-group
+    `GROUPING SETS` under this context. For multiple `GROUPING SETS` in the 
`GROUP BY` clause, we generate
+    a single `GROUPING SETS` by doing a cross-product of the original 
`GROUPING SETS`s. For example,
+    `GROUP BY warehouse, GROUPING SETS((product), ()), GROUPING 
SETS((location, size), (location), (size), ())`
+    and `GROUP BY warehouse, ROLLUP(warehouse), CUBE(location, size)` is 
equivalent to 

Review comment:
       typo? `ROLLUP(warehouse)` -> `ROLLUP(product)`




-- 
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]

Reply via email to