Skip to main content

extract_aggregates

Function extract_aggregates 

Source
pub fn extract_aggregates(
    expr: &Expr,
    alias: &str,
    functions: &FunctionRegistry,
    scope: &TableScope,
) -> Result<Vec<AggregateExpr>>
Expand description

Extract every aggregate function call from expr, binding each to the given output alias. Nested aggregates (e.g. SUM(AVG(x)), which is illegal SQL in Postgres and most other systems) are reported as a planner error rather than silently double-extracted.

scope carries the relations the arguments resolve against, so a column no relation declares is rejected at plan time.