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§
Provided Methods§
Sourcefn eval(&self, input: &DataChunk) -> Result<ArrayRef>
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.
Sourcefn eval_v2(&self, input: &DataChunk) -> Result<ValueImpl>
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.
Sourcefn eval_const(&self) -> Result<Datum>
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".