Expand description
Public helpers for streaming aggregate accumulators.
These thin wrappers expose field-extraction primitives used by the
streaming aggregate accumulators in the nodedb crate.
Each function operates on a single raw MessagePack document byte slice and
returns only the scalar value needed by the calling accumulator — no
document bytes are retained after the call returns.
Functions§
- extract_
bytes - Extract a field or expression result as raw msgpack bytes.
Used by
count_distinct,approx_count_distinct,approx_topk, etc. - extract_
f64 - Extract a numeric (f64) value from
field, or evaluateexprif provided. ReturnsOk(None)when the field is absent or cannot be converted to f64, andErr(EvalError::DivisionByZero)whenexprdivides/mods by zero. - extract_
non_ null - Returns
Ok(Some(()))when the field is present and non-null. Used bycount(field)accumulator to count non-null values. - extract_
str - Extract a display string from
field, or evaluateexprif provided. ReturnsOk(None)when the field is absent. - extract_
sum_ value - Extract the SUM / AVG input of
field, or ofexprif provided, as the number it contributes (Integer,Float, orDecimal). A raw field and an expression result contribute by the same rule,crate::numeric_sum::sum_input: a msgpack number read exactly, or a numeric string read percrate::numeric_sum::numeric_text(aDECIMALcell is stored as its text). ReturnsOk(None)when nothing contributes, andErr(EvalError::DivisionByZero)whenexprdivides/mods by zero. - extract_
value - Extract a field as
Value. Uses direct msgpack→Value for scalars; falls back to full document decode only for complex types.