Skip to main content

wrap_aggregate_cp_items

Function wrap_aggregate_cp_items 

Source
pub fn wrap_aggregate_cp_items(
    plan: SqlPlan,
    items: &[SelectItem],
    grouped: bool,
    functions: &FunctionRegistry,
    scope: &TableScope,
) -> Result<SqlPlan>
Expand description

Wrap plan when items hold a sequence accessor the aggregate cannot carry. A plan with no such item, or one that is not grouped, returns unchanged: convert_projection marks the item on a row plan itself.

grouped says whether the SELECT aggregates (GROUP BY, or an aggregate call in its list). scope is the relation set the SELECT resolved against. A grouped SELECT that does not produce the statement’s output rows (a subquery, CTE body, UNION branch, derived table) refuses the item: the aggregate planner never converts a bare non-key item, so nothing else reports it.