Skip to main content

plan_split_aggregate

Function plan_split_aggregate 

Source
fn plan_split_aggregate(
    promql: Arc<str>,
    partial: NativeTree,
    final_tree: NativeTree,
    binding: FusedSeriesBinding,
    rawinput: LogicalPlan,
    value_schema: DFSchemaRef,
    format: FusedOutputFormat,
) -> Result<FusedSeries>
Expand description

Builds the two nodes a split native aggregate runs in.

The first is a [FusedSeries] over rawinput running the per-series prefix and a Partial aggregate at its root, so each partition exports the state it folded. The second runs the Final aggregate and everything the split moved above it: it reads state where the first reads series. Between them the physical planner puts a SeriesRepartitionExec, which is what makes every row of a group reach one final partition.

format is the representation the caller needs from the second node: the statement’s row table, or the evaluated series frame another native node reads as an operand.

value_schema is the statement’s row-value layout; its value columns must match the partial state’s accumulator count.