Skip to main content

Module aggregate_helpers

Module aggregate_helpers 

Source
Expand description

Public helpers for streaming aggregate accumulators.

These thin wrappers expose field-extraction primitives used by the handlers/aggregate.rs streaming accumulator path 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 evaluate expr if provided. Returns None when the field is absent or cannot be converted to f64.
extract_non_null
Returns Some(()) when the field is present and non-null. Used by count(field) accumulator to count non-null values.
extract_str
Extract a display string from field, or evaluate expr if provided. Returns None when the field is absent.
extract_value
Extract a field as Value. Uses direct msgpack→Value for scalars; falls back to full document decode only for complex types.