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§
Sourcefn init(&self) -> AggregateState
fn init(&self) -> AggregateState
Initialize the aggregation state
Sourcefn accumulate(
&self,
state: &mut AggregateState,
value: &DataValue,
) -> Result<()>
fn accumulate( &self, state: &mut AggregateState, value: &DataValue, ) -> Result<()>
Add a value to the aggregation
Sourcefn finalize(&self, state: AggregateState) -> DataValue
fn finalize(&self, state: AggregateState) -> DataValue
Finalize and return the result
Provided Methods§
Sourcefn requires_numeric(&self) -> bool
fn requires_numeric(&self) -> bool
Check if this function requires numeric input