Skip to main content

Module group_by

Module group_by 

Source
Expand description

GROUP BY key conversion and output naming.

Two concerns live here: turning a parsed GROUP BY clause into grouping key expressions (including resolving a key written as a SELECT-list output alias), and deriving the output column name each key is emitted under.

Functionsยง

convert_group_by
Convert GROUP BY clause to SqlExpr list.
convert_group_by_with_projection
Convert a GROUP BY clause, resolving SELECT-list output aliases.
expr_column_name
The bare column name referenced by an ast::Expr, when it is a simple or compound identifier; None for any other expression shape.
group_by_output_aliases
Derive the SELECT-list output alias for each GROUP BY key by correlating each key with the projection item that references the same column. Returns a Vec parallel to group_by: Some(alias) when a projection item explicitly aliases that grouped column (SELECT k AS label ... GROUP BY k), otherwise None (the output column name falls back to the raw grouped column name).
key_column_name
The bare column name of a GROUP BY key, when the key is a column reference.