Add Considerations for ROLLUP
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/ab26bec4 Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/ab26bec4 Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/ab26bec4 Branch: refs/heads/master Commit: ab26bec4d6a41c6f9217c6719f6736e4c3d4701f Parents: 233d096 Author: liu.yu <[email protected]> Authored: Tue Jan 16 15:58:38 2018 +0800 Committer: liu.yu <[email protected]> Committed: Tue Jan 16 15:58:38 2018 +0800 ---------------------------------------------------------------------- .../sql_functions_and_expressions.adoc | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/ab26bec4/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc ---------------------------------------------------------------------- diff --git a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc index 8f5ab1b..764c749 100644 --- a/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc +++ b/docs/sql_reference/src/asciidoc/_chapters/sql_functions_and_expressions.adoc @@ -6358,6 +6358,31 @@ For example, a query that contains three rollup columns returns the following ro 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. +* The NULLs in selected columns are considered equal and sorted into one NULL group in result sets. + +[[using_rollup_with_the_column_order_reversed]] +==== Using ROLLUP with the Column Order Reversed + +ROLLUP removes the right-most column at each step, therefore the result sets vary with the column order specified in the comma-separated list. + +[cols="50%,50%"] +|=== +| If the column order is _country_, _state_, _city_ and _name_, ROLLUP returns following groupings. +| If the column order is _name_, _city_, _state_ and _country_, ROLLUP returns following groupings. +| _country_, _state_, _city_ and _name_ | _name_, _city_, _state_ and _country_ +| _country_, _state_ and _city_ | _name_, _city_ and _state_ +| _country_ and _state_ | _name_ and _city_ +| _country_ | _name_ +| grand total | grand total +|=== + <<< [[round_function]] == ROUND Function
