pub trait EvaluationHandler: AsAny {
// Required methods
fn new_expression_evaluator(
&self,
input_schema: SchemaRef,
expression: ExpressionRef,
output_type: DataType,
) -> DeltaResult<Arc<dyn ExpressionEvaluator>>;
fn new_predicate_evaluator(
&self,
input_schema: SchemaRef,
predicate: PredicateRef,
) -> DeltaResult<Arc<dyn PredicateEvaluator>>;
fn null_row(
&self,
output_schema: SchemaRef,
) -> DeltaResult<Box<dyn EngineData>>;
fn create_many(
&self,
schema: SchemaRef,
rows: &[&[Scalar]],
) -> DeltaResult<Box<dyn EngineData>>;
}Expand description
Provides expression evaluation capability to Delta Kernel.
Delta Kernel can use this handler to evaluate a predicate on partition filters, fill up partition column values, and any computation on data using Expressions.
Required Methods§
Sourcefn new_expression_evaluator(
&self,
input_schema: SchemaRef,
expression: ExpressionRef,
output_type: DataType,
) -> DeltaResult<Arc<dyn ExpressionEvaluator>>
fn new_expression_evaluator( &self, input_schema: SchemaRef, expression: ExpressionRef, output_type: DataType, ) -> DeltaResult<Arc<dyn ExpressionEvaluator>>
Create an ExpressionEvaluator that can evaluate the given Expression
on columnar batches with the given Schema to produce data of DataType.
If the provided output type is a struct, its fields describe the columns of output produced
by the evaluator. Otherwise, the output schema is a single column named “output” of the
specified output_type. In all cases, the output schema is only used for its names (all
field names will be updated to match) and nullability (non-nullable columns can be converted
to nullable). Any mismatch in types (including number of columns) will produce an error.
§Parameters
input_schema: Schema of the input data.expression: Expression to evaluate.output_type: Expected result data type.
Sourcefn new_predicate_evaluator(
&self,
input_schema: SchemaRef,
predicate: PredicateRef,
) -> DeltaResult<Arc<dyn PredicateEvaluator>>
fn new_predicate_evaluator( &self, input_schema: SchemaRef, predicate: PredicateRef, ) -> DeltaResult<Arc<dyn PredicateEvaluator>>
Create a PredicateEvaluator that can evaluate the given Predicate on columnar
batches with the given Schema to produce a column of boolean results.
The output schema is a single nullable boolean column named “output”.
§Parameters
input_schema: Schema of the input data.predicate: Predicate to evaluate.
Sourcefn null_row(&self, output_schema: SchemaRef) -> DeltaResult<Box<dyn EngineData>>
fn null_row(&self, output_schema: SchemaRef) -> DeltaResult<Box<dyn EngineData>>
Create a single-row all-null-value EngineData with the schema specified by
output_schema.
Sourcefn create_many(
&self,
schema: SchemaRef,
rows: &[&[Scalar]],
) -> DeltaResult<Box<dyn EngineData>>
fn create_many( &self, schema: SchemaRef, rows: &[&[Scalar]], ) -> DeltaResult<Box<dyn EngineData>>
Create a multi-row EngineData by applying the given schema to multiple rows of values.
Each element in rows represents one row of data, where each row is a slice of structured
scalar values (one scalar per top-level field in the schema).
§Parameters
schema: Schema describing the structure of each row.rows: Slice of rows, where each row contains one structured scalar per top-level schema field.
§Returns
A multi-row EngineData containing all rows.
§Errors
Returns an error if any row has a number of scalars that does not match the number of
top-level fields in schema, or if any scalar value cannot be appended to its corresponding
field’s builder (e.g. due to a type mismatch).
§Example
For a schema with fields [add: Struct, remove: Struct], each row should contain exactly 2
scalars: one for the add field and one for the remove field.