Expand description
The run-time state of an aggregate node.
An aggregate folds a whole vector into one series per group, so its node is the one that cannot answer as its input arrives: a group’s value at a grid point is the fold of every value every member of the group has there, and the last member to arrive is the one that decides it. What the node keeps between chunks is therefore the fold’s states and nothing else – a chunk is folded as it arrives and dropped – and it produces once, when the input ends.
That is also why this runtime cannot tell an incomplete group from a complete one: it folds what
it is handed. A AggregateStage::Complete aggregate is correct only if every contribution to
each group lies within the streams this execution reads, which is the physical plan’s job – the
caller that schedules scans and exchanges guarantees it, and a plan that ran a Complete
aggregate once per partition and then combined the answers would be combining values that were
each missing the other partitions’ contributions. The stages that exist for that shape are
AggregateStage::Partial and AggregateStage::Final, which carry kernel accumulator
state between executions.
quantile is the one aggregate here that is not a fold of each point’s values. Its answer is the
φ-quantile of the group’s whole sample set at that point, so there is no fixed-width accumulator
that answers it, and no state that combines two partitions’ quantiles into the quantile of their
union. What the node keeps instead is its input: every series it was handed, until the input
ends, when crate::aggregate::aggregate_quantile answers from all of it at once. That is also
why quantile exists only as AggregateStage::Complete here, and why a plan that would have
to fold it per partition has to keep the previous route instead of splitting it.
There is no spill either: a quantile keeps the whole input of every group, at once, until the
last chunk arrives, so what it holds is not bounded by the number of groups the way a fixed-width
accumulator’s is – it is bounded by the pool. Each chunk is admitted before it is kept and the
reservation settles on the input retained so far (AggregateRuntime::accumulate), so a
statement whose groups’ samples do not fit the pool is refused rather than served from disk, and
a caller that needs an answer in bounded memory needs a wider pool rather than a wider node.
Everything else in this runtime trades memory for the width of a point: a fold’s state per group
and point, this one’s whole input.
Structs§
- Aggregate
Runtime 🔒 - One aggregate node’s states, from the first chunk it is handed to the series it finishes with.
- Quantile
Input 🔒 - The input a
quantileaggregate keeps, until it has all of it.
Enums§
- Aggregate
Output 🔒 - The output shape produced by an aggregate stage.
- Fold 🔒
- What a
Completeaggregate keeps while its input arrives.
Constants§
- QUANTILE_
PARAMETER_ 🔒FIELD - The field the
quantileparameter is bound under, which the kernel reads as its scalar.
Functions§
- charge_
samples 🔒 - Charges the series a finished aggregate hands over, plus the queue they enter.
- folded_
chunk 🔒 - The rejection of a chunk that is not the layout this node folds.
- no_fold 🔒
- The error for a fold that has already been finished.
- quantile_
parameter 🔒 - The parameter a
quantilereads at each point: the φ the query wrote, unlabelled and single field, atpositionsand nowhere else. - quantile_
parameter_ 🔒bound_ bytes - The most a
quantileparameter overinputcan cost, before it is built. - quantile_
positions 🔒 - The points the retained input holds, once each, in ascending order.
- quantile_
workspace_ 🔒bytes - The bytes the
quantilekernel needs beside its retained input while it answers.