Skip to main content

SyncExpression

Trait SyncExpression 

Source
pub trait SyncExpression: ExpressionInfo {
    // Required method
    fn eval_row(&self, input: &OwnedRow) -> Result<Datum>;

    // Provided methods
    fn eval(&self, input: &DataChunk) -> Result<ArrayRef> { ... }
    fn eval_v2(&self, input: &DataChunk) -> Result<ValueImpl> { ... }
    fn eval_const(&self) -> Result<Datum> { ... }
}
Expand description

Interface of a synchronous 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 eval_row(&self, input: &OwnedRow) -> Result<Datum>

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

Provided Methods§

Source

fn eval(&self, input: &DataChunk) -> Result<ArrayRef>

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(&self, input: &DataChunk) -> Result<ValueImpl>

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.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + SyncExpression + ?Sized> SyncExpression for &'a T

Source§

fn eval(&self, input: &DataChunk) -> Result<ArrayRef>

Source§

fn eval_v2(&self, input: &DataChunk) -> Result<ValueImpl>

Source§

fn eval_row(&self, input: &OwnedRow) -> Result<Datum>

Source§

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

Source§

impl<T: SyncExpression + ?Sized> SyncExpression for Arc<T>
where Arc<T>: ExpressionInfo,

Source§

fn eval(&self, input: &DataChunk) -> Result<ArrayRef>

Source§

fn eval_v2(&self, input: &DataChunk) -> Result<ValueImpl>

Source§

fn eval_row(&self, input: &OwnedRow) -> Result<Datum>

Source§

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

Source§

impl<T: SyncExpression + ?Sized> SyncExpression for Box<T>
where Box<T>: ExpressionInfo,

Source§

fn eval(&self, input: &DataChunk) -> Result<ArrayRef>

Source§

fn eval_v2(&self, input: &DataChunk) -> Result<ValueImpl>

Source§

fn eval_row(&self, input: &OwnedRow) -> Result<Datum>

Source§

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

Implementors§