Based on those pages [1], [2], I understand that for group sets to be a
rollup, all groups in the group set must be the same as the union set of
groups but with gradually one less group removed from the end. For example,
the following are valid rollup groups (The union set of groups is *(G1, G2,
G3)*):
((G1, G2, G3), (G1, G2), (G1), () )
While the following isn't
((G1, G2, G3), *(G1, G3)*, (G1), () )
- because the second group skipped *G2* and took *G3* instead.
or
((G1, G2, G3), *(G2, G3)*, (G1), () )
- because the second group didn't start from *G1*, but started from *G2*.
I'm saying this because I believe this method [3] isn't functioning
correctly because it considers the group sets ({3, 5}, {5}, {}) to be a
rollup although the second group started with "5" and not "3".
Or am I missing something?
[1]
https://www.postgresql.org/docs/devel/queries-table-expressions.html#QUERIES-GROUPING-SETS
[2] http://www.sqlservertutorial.net/sql-server-basics/sql-server-rollup/
[3]
https://github.com/apache/calcite/blob/5ec3a2a503dcf26fe1b3cad8a5a9467264213dcf/core/src/main/java/org/apache/calcite/rel/core/Aggregate.java#L496
Thanks,
Gelbana