pub enum AggSpec {
Count,
Sum(ColId),
Avg(ColId),
}Expand description
Which aggregate a Reduce column computes, in output-column order
(REDUCE-DESIGN.md §5). All three are invertible — a Remove folds into a
fixed-size accumulator without re-reading the inputs — which is what lets Reduce
maintain them from a pure delta stream.
Variants§
Count
count(*) — counts input rows (NULLs included). Add +1, Remove -1.
Sum(ColId)
sum(col) — Σ of the column’s non-NULL values. Add +v, Remove -v.
Avg(ColId)
avg(col) — sum(col) / count(col) over non-NULL values (SQL semantics:
the denominator is the non-NULL count, not count(*)); NULL on empty.
Implementations§
Source§impl AggSpec
impl AggSpec
Sourcepub fn output_type(&self, input: &Schema) -> ValueType
pub fn output_type(&self, input: &Schema) -> ValueType
The declared ValueType of this aggregate’s output column (design 226
§4.1): count and avg are Number; sum follows its input column —
Int over a declared int64 input (the exact-i64 sum plane), Number
otherwise. Shared by Reduce::with_input_types and the builder’s
view-schema twins so the two derivations cannot drift.