File tree Expand file tree Collapse file tree 1 file changed +14
-1
lines changed
vortex-array/src/aggregate_fn/fns/sum Expand file tree Collapse file tree 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,20 @@ fn sum_output_ptype(ptype: PType) -> PType {
5757///
5858/// For primitive numeric types, the output is widened (unsigned -> u64, signed -> i64,
5959/// float -> f64). For boolean inputs, `true` counts as 1 and `false` as 0, producing
60- /// a u64 output.
60+ /// a u64 output. All output types are nullable.
61+ ///
62+ /// # Flush semantics
63+ ///
64+ /// - **Empty group** (flush with no prior accumulate/merge): produces **zero** (the additive
65+ /// identity).
66+ /// - **All-null group** (accumulate called but every value was null): produces **null**.
67+ /// - **Checked overflow**: produces **null**, and `is_saturated()` returns true so callers can
68+ /// skip further accumulation.
69+ ///
70+ /// Note: this differs from the [`compute::sum`](crate::compute::sum) function, which treats
71+ /// both empty and all-null arrays identically (returning the zero accumulator). The aggregate
72+ /// distinguishes the two cases because all-null is semantically "unknown" while empty is
73+ /// "no data, so the identity applies".
6174#[ derive( Clone ) ]
6275pub struct Sum ;
6376
You can’t perform that action at this time.
0 commit comments