Skip to main content

Accumulator

Trait Accumulator 

Source
pub trait Accumulator: Send {
    // Required methods
    fn update(&mut self, value: Option<SqlValue>) -> Result<()>;
    fn state(&self) -> Result<Vec<SqlValue>>;
    fn merge(&mut self, state: &[SqlValue]) -> Result<()>;
    fn finalize(&self) -> Result<SqlValue>;
    fn clone_box(&self) -> Box<dyn Accumulator>;

    // Provided method
    fn retained_bytes(&self) -> u64 { ... }
}
Expand description

Accumulator interface for aggregate function execution.

Required Methods§

Source

fn update(&mut self, value: Option<SqlValue>) -> Result<()>

Update the accumulator with a new value (None for COUNT(*) rows).

Source

fn state(&self) -> Result<Vec<SqlValue>>

Return the serializable partial aggregate state.

Source

fn merge(&mut self, state: &[SqlValue]) -> Result<()>

Merge a partial state produced by an accumulator of the same function.

Source

fn finalize(&self) -> Result<SqlValue>

Finalize the accumulator and return the resulting SqlValue.

Source

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

Clone the accumulator as a trait object.

Provided Methods§

Source

fn retained_bytes(&self) -> u64

Estimated bytes retained by dynamically allocated accumulator state.

Window execution uses this to charge the shared operator memory budget while an accumulator is alive.

Trait Implementations§

Source§

impl Clone for Box<dyn Accumulator>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§