Trait tidb_query_aggr::AggrFunction [−][src]
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:
-
Each aggregate function associates a state structure, storing partially computed aggregate results.
-
The caller calls
update()
orupdate_vector()
for each row to update the state. -
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.
Implementors
impl AggrFunction for AggrFnAvgForEnum where
VectorValue: VectorValueExt<Enum>,
[src]
VectorValue: VectorValueExt<Enum>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl AggrFunction for AggrFnAvgForSet where
VectorValue: VectorValueExt<Set>,
[src]
VectorValue: VectorValueExt<Set>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl AggrFunction for AggrFnCount
[src]
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl AggrFunction for AggrFnSumForEnum where
VectorValue: VectorValueExt<Decimal>,
[src]
VectorValue: VectorValueExt<Decimal>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl AggrFunction for AggrFnSumForSet where
VectorValue: VectorValueExt<Decimal>,
[src]
VectorValue: VectorValueExt<Decimal>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<C, E> AggrFunction for AggFnExtremumForBytes<C, E> where
C: Collator,
E: Extremum,
VectorValue: VectorValueExt<Bytes>,
[src]
C: Collator,
E: Extremum,
VectorValue: VectorValueExt<Bytes>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<E> AggrFunction for AggFnExtremumForEnum<E> where
E: Extremum,
VectorValue: VectorValueExt<Enum>,
[src]
E: Extremum,
VectorValue: VectorValueExt<Enum>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<E> AggrFunction for AggFnExtremumForSet<E> where
E: Extremum,
VectorValue: VectorValueExt<Set>,
[src]
E: Extremum,
VectorValue: VectorValueExt<Set>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<E, const IS_UNSIGNED: bool> AggrFunction for AggFnExtremumForInt<E, IS_UNSIGNED> where
E: Extremum,
VectorValue: VectorValueExt<Int>,
[src]
E: Extremum,
VectorValue: VectorValueExt<Int>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<T> AggrFunction for AggrFnAvg<T> where
T: Summable,
VectorValue: VectorValueExt<T>,
[src]
T: Summable,
VectorValue: VectorValueExt<T>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<T> AggrFunction for AggrFnFirst<T> where
T: EvaluableRef<'static> + 'static,
VectorValue: VectorValueExt<T::EvaluableType>,
[src]
T: EvaluableRef<'static> + 'static,
VectorValue: VectorValueExt<T::EvaluableType>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<T> AggrFunction for AggrFnSum<T> where
T: Summable,
VectorValue: VectorValueExt<T>,
[src]
T: Summable,
VectorValue: VectorValueExt<T>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<T, E> AggrFunction for AggFnExtremum<T, E> where
T: EvaluableRef<'static> + 'static + Ord,
E: Extremum,
VectorValue: VectorValueExt<T::EvaluableType>,
[src]
T: EvaluableRef<'static> + 'static + Ord,
E: Extremum,
VectorValue: VectorValueExt<T::EvaluableType>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<T, V> AggrFunction for AggrFnVariance<T, V> where
T: Summable,
V: VarianceType,
VectorValue: VectorValueExt<T>,
[src]
T: Summable,
V: VarianceType,
VectorValue: VectorValueExt<T>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<T: BitOp> AggrFunction for AggrFnBitOp<T>
[src]
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<V> AggrFunction for AggrFnVarianceForEnum<V> where
V: VarianceType,
VectorValue: VectorValueExt<Decimal>,
[src]
V: VarianceType,
VectorValue: VectorValueExt<Decimal>,
fn name(&self) -> &'static str
[src]
fn create_state(&self) -> Box<dyn AggrFunctionState>
[src]
impl<V> AggrFunction for AggrFnVarianceForSet<V> where
V: VarianceType,
VectorValue: VectorValueExt<Decimal>,
[src]
V: VarianceType,
VectorValue: VectorValueExt<Decimal>,