Skip to main content

DynAccumulator

Trait DynAccumulator 

Source
pub trait DynAccumulator: 'static + Send {
    // Required methods
    fn accumulate(
        &mut self,
        batch: &ArrayRef,
        ctx: &mut ExecutionCtx,
    ) -> VortexResult<()>;
    fn combine_partials(&mut self, other: Scalar) -> VortexResult<()>;
    fn is_saturated(&self) -> bool;
    fn reset(&mut self);
    fn partial_scalar(&self) -> VortexResult<Scalar>;
    fn final_scalar(&self) -> VortexResult<Scalar>;
    fn flush(&mut self) -> VortexResult<Scalar>;
    fn finish(&mut self) -> VortexResult<Scalar>;
}
Expand description

A trait object for type-erased accumulators, used for dynamic dispatch when the aggregate function is not known at compile time.

Required Methods§

Source

fn accumulate( &mut self, batch: &ArrayRef, ctx: &mut ExecutionCtx, ) -> VortexResult<()>

Accumulate a new array into the accumulator’s state.

Source

fn combine_partials(&mut self, other: Scalar) -> VortexResult<()>

Fold an external partial-state scalar into this accumulator’s state.

The scalar must have the dtype reported by the vtable’s partial_dtype for the options and input dtype used to construct this accumulator.

Source

fn is_saturated(&self) -> bool

Whether the accumulator’s result is fully determined.

Source

fn reset(&mut self)

Reset the accumulator’s state to the empty group.

Source

fn partial_scalar(&self) -> VortexResult<Scalar>

Read the current partial state as a scalar without resetting it.

The returned scalar has the dtype reported by the vtable’s partial_dtype.

Source

fn final_scalar(&self) -> VortexResult<Scalar>

Compute the final aggregate result as a scalar without resetting state.

Source

fn flush(&mut self) -> VortexResult<Scalar>

Flush the accumulation state and return the partial aggregate result as a scalar.

Resets the accumulator state back to the initial state.

Source

fn finish(&mut self) -> VortexResult<Scalar>

Finish the accumulation and return the final aggregate result as a scalar.

Resets the accumulator state back to the initial state.

Implementors§