pub trait FunctionRewrite {
    // 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-array crate.

Required Methods§

source

fn name(&self) -> &str

Return a human readable name for this rewrite

source

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.

Implementors§