Skip to main content

DynAccumulator

Trait DynAccumulator 

Source
pub trait DynAccumulator: Send {
    // Required methods
    fn add_event(&mut self, event: &Event);
    fn merge_dyn(&mut self, other: &dyn DynAccumulator);
    fn result_scalar(&self) -> ScalarResult;
    fn is_empty(&self) -> bool;
    fn clone_box(&self) -> Box<dyn DynAccumulator>;
    fn serialize(&self) -> Vec<u8> ;
    fn result_field(&self) -> Field;
    fn type_tag(&self) -> &'static str;
    fn as_any(&self) -> &dyn Any;
}
Expand description

Dynamic accumulator trait for composite aggregation.

Unlike the static Accumulator trait, this works with events directly and returns ScalarResult for type-flexible output. Used by CompositeAggregator to combine multiple aggregates per window.

§Ring Architecture

Dynamic dispatch has overhead (~2-5ns per vtable call), so composite aggregation is intended for Ring 1 workloads. Ring 0 continues to use the static Aggregator + Accumulator path.

Required Methods§

Source

fn add_event(&mut self, event: &Event)

Adds an event to the accumulator.

Source

fn merge_dyn(&mut self, other: &dyn DynAccumulator)

Merges another accumulator of the same type into this one.

§Panics

May panic if other is not the same concrete type.

Source

fn result_scalar(&self) -> ScalarResult

Returns the current aggregate result.

Source

fn is_empty(&self) -> bool

Returns true if no values have been accumulated.

Source

fn clone_box(&self) -> Box<dyn DynAccumulator>

Creates a boxed clone of this accumulator.

Source

fn serialize(&self) -> Vec<u8>

Serializes the accumulator state to bytes (for checkpointing).

Source

fn result_field(&self) -> Field

Returns the Arrow field descriptor for this accumulator’s output.

Source

fn type_tag(&self) -> &'static str

Returns a type tag for deserialization dispatch.

Source

fn as_any(&self) -> &dyn Any

Returns self as Any for downcasting (used by DataFusion bridge).

Implementors§