Trait tidb_query_aggr::AggrFunction[][src]

pub trait AggrFunction: Debug + Send + 'static {
    fn name(&self) -> &'static str;
fn create_state(&self) -> Box<dyn AggrFunctionState>; }

A trait for all single parameter aggregate functions.

Unlike ordinary function, aggregate function calculates a summary value over multiple rows. To save memory, this functionality is provided via an incremental update model:

  1. Each aggregate function associates a state structure, storing partially computed aggregate results.

  2. The caller calls update() or update_vector() for each row to update the state.

  3. The caller finally calls push_result() to aggregate a summary value and push it into the given data container.

This trait can be auto derived by using tidb_query_codegen::AggrFunction.

Required methods

fn name(&self) -> &'static str[src]

The display name of the function.

fn create_state(&self) -> Box<dyn AggrFunctionState>[src]

Creates a new state instance. Different states aggregate independently.

Loading content...

Implementors

impl AggrFunction for AggrFnAvgForEnum where
    VectorValue: VectorValueExt<Enum>, 
[src]

impl AggrFunction for AggrFnAvgForSet where
    VectorValue: VectorValueExt<Set>, 
[src]

impl AggrFunction for AggrFnCount[src]

impl AggrFunction for AggrFnSumForEnum where
    VectorValue: VectorValueExt<Decimal>, 
[src]

impl AggrFunction for AggrFnSumForSet where
    VectorValue: VectorValueExt<Decimal>, 
[src]

impl<C, E> AggrFunction for AggFnExtremumForBytes<C, E> where
    C: Collator,
    E: Extremum,
    VectorValue: VectorValueExt<Bytes>, 
[src]

impl<E> AggrFunction for AggFnExtremumForEnum<E> where
    E: Extremum,
    VectorValue: VectorValueExt<Enum>, 
[src]

impl<E> AggrFunction for AggFnExtremumForSet<E> where
    E: Extremum,
    VectorValue: VectorValueExt<Set>, 
[src]

impl<E, const IS_UNSIGNED: bool> AggrFunction for AggFnExtremumForInt<E, IS_UNSIGNED> where
    E: Extremum,
    VectorValue: VectorValueExt<Int>, 
[src]

impl<T> AggrFunction for AggrFnAvg<T> where
    T: Summable,
    VectorValue: VectorValueExt<T>, 
[src]

impl<T> AggrFunction for AggrFnFirst<T> where
    T: EvaluableRef<'static> + 'static,
    VectorValue: VectorValueExt<T::EvaluableType>, 
[src]

impl<T> AggrFunction for AggrFnSum<T> where
    T: Summable,
    VectorValue: VectorValueExt<T>, 
[src]

impl<T, E> AggrFunction for AggFnExtremum<T, E> where
    T: EvaluableRef<'static> + 'static + Ord,
    E: Extremum,
    VectorValue: VectorValueExt<T::EvaluableType>, 
[src]

impl<T, V> AggrFunction for AggrFnVariance<T, V> where
    T: Summable,
    V: VarianceType,
    VectorValue: VectorValueExt<T>, 
[src]

impl<T: BitOp> AggrFunction for AggrFnBitOp<T>[src]

impl<V> AggrFunction for AggrFnVarianceForEnum<V> where
    V: VarianceType,
    VectorValue: VectorValueExt<Decimal>, 
[src]

impl<V> AggrFunction for AggrFnVarianceForSet<V> where
    V: VarianceType,
    VectorValue: VectorValueExt<Decimal>, 
[src]

Loading content...