Skip to main content

aggregate_targets

Function aggregate_targets 

Source
pub fn aggregate_targets<'a>(
    aggregates: &dyn AggregateClassifier,
    statement: &'a QueryBlockPlan,
) -> Vec<&'a ScalarExpr>
Expand description

Aggregate states needed by a query block, in accumulator order.

Projection aggregates remain first (including repeated expressions) because projection rewriting consumes them positionally. Aggregates referenced only by HAVING are appended once as hidden targets, matching PostgreSQL’s rule that HAVING need not expose an aggregate in the SELECT list.