Github user DaveBirdsall commented on a diff in the pull request:
https://github.com/apache/trafodion/pull/1399#discussion_r162193263
--- Diff:
docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---
@@ -6337,6 +6337,300 @@ UPDATE persnl.job
SET jobdesc = RIGHT (jobdesc, 12);
```
+<<<
+[[rollup_function]]
+== ROLLUP Function
+
+The ROLLUP function calculates multiple levels of subtotals aggregating
from right to left through the comma-separated list of columns, and provides a
grand total. It is a an extension to the `GROUP BY` clause and can be used with
`ORDER BY` to sort the results.
+
+```
+SELECTâ¦GROUP BY ROLLUP (column 1, [column 2,]â¦[column n])
+```
+
+ROLLUP generates n+1 levels of subtotals and grand total, where n is the
number of the selected column(s).
+
+For example, a query that contains three rollup columns returns the
following rows:
+
+* First-level: stand aggregate values calculated by GROUP BY clause
without using ROLLUP.
+* Second-level: subtotals aggregating across column 3 for each combination
of column 1 and column 2.
+* Third-level: subtotals aggregating across column 2 and column 3 for each
column 1.
+* Fourth-level: the grand total row.
+
+NOTE: Trafodion does not support CUBE function which works slightly
differently from ROLLUP.
+
+[[considerations_for_rollup]]
+=== Considerations for ROLLUP
+
+[[null_in_result_sets]]
+==== NULL in Result Sets
+
+* The NULLs in each super-aggregate row represent subtotals and grand
total.
--- End diff --
Possible wordsmith: "In super-aggregate rows representing subtotals or the
grand total, lower level grouping columns are replaced by NULLs."
---