pub trait FunctionRewrite: Debug {
// Required methods
fn name(&self) -> &str;
fn rewrite(
&self,
expr: Expr,
schema: &DFSchema,
config: &ConfigOptions,
) -> Result<Transformed<Expr>>;
}
Expand description
Trait for rewriting Expr
s into function calls.
This trait is used with FunctionRegistry::register_function_rewrite
to
to evaluating Expr
s 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>>
fn rewrite( &self, expr: Expr, schema: &DFSchema, config: &ConfigOptions, ) -> Result<Transformed<Expr>>
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.