pub struct ReduceAcc {
pub int_sum: i128,
pub float_sum: f64,
pub non_null: i64,
pub float_count: i64,
}Expand description
One per-column running accumulator for a Sum/Avg aggregate inside a
StorageValue::Reduce (REDUCE-DESIGN.md §5). The integer and float sums are kept
apart so the emitted sum matches SQLite’s typing — integer iff every summed
value was an integer, real once any float contributes — and stays fully invertible
(a later Remove of a float value demotes the result back to an integer).
int_sum/float_sum— running Σ of the column’s integer- and float-typed non-NULLvalues.int_sumis i128 (design 226 §5.3): the accumulator folds deltas in arrival order (Removes included), so a transient pasti64::MAXthat SQLite’s scan order would never see must not error or wrap — and-1 × i64::MINmust not overflow on a Remove. Only the emitted total is bounded:sumraises a typed error at emit when the set total leaves the i64 range (op/reduce.rs’ssum_value).non_null— count of non-NULLvalues; this isavg’s denominator (SQLcount(col), not the rowcount), andavgemitsNULLwhen it is0.float_count— how many contributing values were float;0⇒sumemitsInt, elseFloat.
Fields§
§int_sum: i128§float_sum: f64§non_null: i64§float_count: i64Trait Implementations§
impl StructuralPartialEq for ReduceAcc
Auto Trait Implementations§
impl Freeze for ReduceAcc
impl RefUnwindSafe for ReduceAcc
impl Send for ReduceAcc
impl Sync for ReduceAcc
impl Unpin for ReduceAcc
impl UnsafeUnpin for ReduceAcc
impl UnwindSafe for ReduceAcc
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more