Skip to main content

StatDerivation

Trait StatDerivation 

Source
pub trait StatDerivation:
    Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn scalar_fn_id(&self) -> ScalarFnId;
    fn derive_stat(
        &self,
        expr: &BoundExpression,
        aggregate_fn: &AggregateFnRef,
        session: &VortexSession,
    ) -> Option<BoundExpression>;
}
Expand description

Expresses the statistics of a scalar function’s result in terms of the statistics of its inputs.

At most one derivation is registered per scalar function. When one is registered, it decides every statistic of expressions rooted at that function: stats rewrites never read a statistic stored for such an expression itself.

Required Methods§

Source

fn scalar_fn_id(&self) -> ScalarFnId

Returns the scalar function id whose statistics this derivation describes.

Source

fn derive_stat( &self, expr: &BoundExpression, aggregate_fn: &AggregateFnRef, session: &VortexSession, ) -> Option<BoundExpression>

Expresses the statistic aggregate_fn of expr, whose root scalar function id is Self::scalar_fn_id, as an expression over statistics of other expressions.

Returns None when the statistic cannot be known from statistics.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§