Skip to main content

Module grouping_sets

Module grouping_sets 

Source
Expand description

ROLLUP / CUBE / GROUPING SETS expansion and canonical key extraction.

The public entry point is expand_group_by, which inspects the raw AST GROUP BY clause and returns:

  • canonical_keys: the full deduplicated column list (indices 0..N).
  • grouping_sets: one entry per set; each entry is the subset of canonical-key indices that are active (non-NULL) in that set.

GROUPING(col) at query time resolves col to its canonical-key index and checks whether that bit is absent from the row’s active set.

Structs§

GroupingSetsExpansion
Result of expanding a GROUP BY clause that contains ROLLUP/CUBE/GROUPING SETS.

Functions§

expand_group_by
Expand the GROUP BY clause if it contains ROLLUP/CUBE/GROUPING SETS.
resolve_grouping_col
Resolve the canonical index for a GROUPING(col) argument.