risingwave_expr::expr

Trait Expression

source
pub trait Expression:
    Debug
    + Sync
    + Send {
    // Required methods
    fn return_type(&self) -> DataType;
    fn eval_row<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: &'life1 OwnedRow,
    ) -> Pin<Box<dyn Future<Output = Result<Datum>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;

    // Provided methods
    fn eval<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: &'life1 DataChunk,
    ) -> Pin<Box<dyn Future<Output = Result<ArrayRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn eval_v2<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: &'life1 DataChunk,
    ) -> Pin<Box<dyn Future<Output = Result<ValueImpl>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn eval_const(&self) -> Result<Datum> { ... }
    fn input_ref_index(&self) -> Option<usize> { ... }
}
Expand description

Interface of an expression.

There’re two functions to evaluate an expression: eval and eval_v2, exactly one of them should be implemented. Prefer calling and implementing eval_v2 instead of eval if possible, to gain the performance benefit of scalar expression.

Required Methods§

source

fn return_type(&self) -> DataType

Get the return data type.

source

fn eval_row<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 OwnedRow, ) -> Pin<Box<dyn Future<Output = Result<Datum>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Evaluate the expression in row-based execution. Returns a nullable scalar.

Provided Methods§

source

fn eval<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 DataChunk, ) -> Pin<Box<dyn Future<Output = Result<ArrayRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Evaluate the expression in vectorized execution. Returns an array.

The default implementation calls eval_v2 and always converts the result to an array.

source

fn eval_v2<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 DataChunk, ) -> Pin<Box<dyn Future<Output = Result<ValueImpl>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Evaluate the expression in vectorized execution. Returns a value that can be either an array, or a scalar if all values in the array are the same.

The default implementation calls eval and puts the result into the Array variant.

source

fn eval_const(&self) -> Result<Datum>

Evaluate if the expression is constant.

source

fn input_ref_index(&self) -> Option<usize>

Get the index if the expression is an InputRef.

Implementations on Foreign Types§

source§

impl<'a, T: 'a + Expression + ?Sized> Expression for &'a T
where &'a T: Debug + Sync + Send,

source§

fn return_type(&self) -> DataType

source§

fn eval<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 DataChunk, ) -> Pin<Box<dyn Future<Output = Result<ArrayRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn eval_v2<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 DataChunk, ) -> Pin<Box<dyn Future<Output = Result<ValueImpl>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn eval_row<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 OwnedRow, ) -> Pin<Box<dyn Future<Output = Result<Datum>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn eval_const(&self) -> Result<Datum>

source§

fn input_ref_index(&self) -> Option<usize>

source§

impl<T: Expression + ?Sized> Expression for Box<T>
where Box<T>: Debug + Sync + Send,

source§

fn return_type(&self) -> DataType

source§

fn eval<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 DataChunk, ) -> Pin<Box<dyn Future<Output = Result<ArrayRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn eval_v2<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 DataChunk, ) -> Pin<Box<dyn Future<Output = Result<ValueImpl>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn eval_row<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 OwnedRow, ) -> Pin<Box<dyn Future<Output = Result<Datum>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

source§

fn eval_const(&self) -> Result<Datum>

source§

fn input_ref_index(&self) -> Option<usize>

Implementors§