pub trait FunctionRewrite: Debug {
// Required methods
fn name(&self) -> &str;
fn rewrite(
&self,
expr: Expr,
schema: &DFSchema,
config: &ConfigOptions,
) -> Result<Transformed<Expr>, DataFusionError>;
}Expand description
Trait for rewriting Exprs into function calls.
This trait is used with FunctionRegistry::register_function_rewrite to
to evaluating Exprs using functions that may not be built in to DataFusion
For example, concatenating arrays a || b is represented as
Operator::ArrowAt, but can be implemented by calling a function
array_concat from the functions-nested crate.
Required Methods§
Sourcefn rewrite(
&self,
expr: Expr,
schema: &DFSchema,
config: &ConfigOptions,
) -> Result<Transformed<Expr>, DataFusionError>
fn rewrite( &self, expr: Expr, schema: &DFSchema, config: &ConfigOptions, ) -> Result<Transformed<Expr>, DataFusionError>
Potentially rewrite expr to some other expression
Note that recursion is handled by the caller – this method should only
handle expr, not recurse to its children.