final class GroupingSet
    implements Node
    uses Snapshot
Public API: explicitly declared with @visibility public.

A grouping set of GROUP BY: the empty set (), ROLLUP, CUBE or GROUPING SETS.

Mirrors PostgreSQL's GroupingSet. ROLLUP and CUBE hold expressions and grouping rows (a row written without ROW groups its fields together); GROUPING SETS holds expressions, grouping rows and nested grouping sets. The selection that holds the set derives its expressions with the rules of GROUP BY. Source: https://www.postgresql.org/docs/17/queries-table-expressions.html#QUERIES-GROUPING-SETS.

Reading a ROLLUPdoctest
$query = (new \SqlSemantics\Platform\PostgreSql\Semantics())->analyze('SELECT 1 GROUP BY ROLLUP (1), ()');
    [$query->statement->groupBy[0]->kind->value, count($query->statement->groupBy[1]->members)] // => ['ROLLUP', 0]
Refusing an empty ROLLUPdoctest
new \SqlSemantics\Platform\PostgreSql\Statement\Query\Grouping\GroupingSet(\SqlSemantics\Platform\PostgreSql\Statement\Query\Grouping\GroupingSetKind::Rollup) // throws \SqlSemantics\Platform\PostgreSql\Model\Diagnostic\InvalidConstruction

Properties§

public list<Scalar|GroupingRow|GroupingSet> $members

Methods§

public function __construct(
    public GroupingSetKind $kind,
    list<Scalar|GroupingRow|GroupingSet> $members = [],
)

Parameters

$kindGroupingSetKindThe kind of set
$memberslist<Scalar|GroupingRow|GroupingSet>The members in written order: none for the empty set, expressions and rows for ROLLUP and CUBE, expressions, rows and sets for GROUPING SETS
Calls 10
public function render(Output $out): void

Writes the set.

Parameters

$outOutput
Calls 4

Test cases 2§

Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.

Dedicated tests 1
Other tests reaching this symbol 1

Relations§

Instantiated in 4
Constant reads 1
Type checks 2
Type declarations 1