AggregateFunction

Trait AggregateFunction 

Source
pub trait AggregateFunction: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn init(&self) -> AggregateState;
    fn accumulate(
        &self,
        state: &mut AggregateState,
        value: &DataValue,
    ) -> Result<()>;
    fn finalize(&self, state: AggregateState) -> DataValue;

    // Provided method
    fn requires_numeric(&self) -> bool { ... }
}
Expand description

Trait for all aggregate functions

Required Methods§

Source

fn name(&self) -> &str

Name of the function (e.g., “SUM”, “AVG”)

Source

fn init(&self) -> AggregateState

Initialize the aggregation state

Source

fn accumulate( &self, state: &mut AggregateState, value: &DataValue, ) -> Result<()>

Add a value to the aggregation

Source

fn finalize(&self, state: AggregateState) -> DataValue

Finalize and return the result

Provided Methods§

Source

fn requires_numeric(&self) -> bool

Check if this function requires numeric input

Implementors§