Trait datafusion_expr::planner::ExprPlanner

source ·
pub trait ExprPlanner: Send + Sync {
    // Provided methods
    fn plan_binary_op(
        &self,
        expr: RawBinaryExpr,
        _schema: &DFSchema,
    ) -> Result<PlannerResult<RawBinaryExpr>> { ... }
    fn plan_field_access(
        &self,
        expr: RawFieldAccessExpr,
        _schema: &DFSchema,
    ) -> Result<PlannerResult<RawFieldAccessExpr>> { ... }
    fn plan_array_literal(
        &self,
        exprs: Vec<Expr>,
        _schema: &DFSchema,
    ) -> Result<PlannerResult<Vec<Expr>>> { ... }
    fn plan_position(&self, args: Vec<Expr>) -> Result<PlannerResult<Vec<Expr>>> { ... }
    fn plan_dictionary_literal(
        &self,
        expr: RawDictionaryExpr,
        _schema: &DFSchema,
    ) -> Result<PlannerResult<RawDictionaryExpr>> { ... }
    fn plan_extract(&self, args: Vec<Expr>) -> Result<PlannerResult<Vec<Expr>>> { ... }
    fn plan_substring(
        &self,
        args: Vec<Expr>,
    ) -> Result<PlannerResult<Vec<Expr>>> { ... }
    fn plan_struct_literal(
        &self,
        args: Vec<Expr>,
        _is_named_struct: bool,
    ) -> Result<PlannerResult<Vec<Expr>>> { ... }
    fn plan_overlay(&self, args: Vec<Expr>) -> Result<PlannerResult<Vec<Expr>>> { ... }
    fn plan_make_map(&self, args: Vec<Expr>) -> Result<PlannerResult<Vec<Expr>>> { ... }
    fn plan_compound_identifier(
        &self,
        _field: &Field,
        _qualifier: Option<&TableReference>,
        _nested_names: &[String],
    ) -> Result<PlannerResult<Vec<Expr>>> { ... }
    fn plan_any(
        &self,
        expr: RawBinaryExpr,
    ) -> Result<PlannerResult<RawBinaryExpr>> { ... }
}
Expand description

This trait allows users to customize the behavior of the SQL planner

Provided Methods§

source

fn plan_binary_op( &self, expr: RawBinaryExpr, _schema: &DFSchema, ) -> Result<PlannerResult<RawBinaryExpr>>

Plan the binary operation between two expressions, returns original BinaryExpr if not possible

source

fn plan_field_access( &self, expr: RawFieldAccessExpr, _schema: &DFSchema, ) -> Result<PlannerResult<RawFieldAccessExpr>>

Plan the field access expression

returns original FieldAccessExpr if not possible

source

fn plan_array_literal( &self, exprs: Vec<Expr>, _schema: &DFSchema, ) -> Result<PlannerResult<Vec<Expr>>>

Plan the array literal, returns OriginalArray if not possible

Returns origin expression arguments if not possible

source

fn plan_position(&self, args: Vec<Expr>) -> Result<PlannerResult<Vec<Expr>>>

source

fn plan_dictionary_literal( &self, expr: RawDictionaryExpr, _schema: &DFSchema, ) -> Result<PlannerResult<RawDictionaryExpr>>

Plan the dictionary literal { key: value, ...}

Returns origin expression arguments if not possible

source

fn plan_extract(&self, args: Vec<Expr>) -> Result<PlannerResult<Vec<Expr>>>

Plan an extract expression, e.g., EXTRACT(month FROM foo)

Returns origin expression arguments if not possible

source

fn plan_substring(&self, args: Vec<Expr>) -> Result<PlannerResult<Vec<Expr>>>

Plan an substring expression, e.g., SUBSTRING(<expr> [FROM <expr>] [FOR <expr>])

Returns origin expression arguments if not possible

source

fn plan_struct_literal( &self, args: Vec<Expr>, _is_named_struct: bool, ) -> Result<PlannerResult<Vec<Expr>>>

Plans a struct struct(expression1[, ..., expression_n]) literal based on the given input expressions. This function takes a vector of expressions and a boolean flag indicating whether the struct uses the optional name

Returns a PlannerResult containing either the planned struct expressions or the original input expressions if planning is not possible.

source

fn plan_overlay(&self, args: Vec<Expr>) -> Result<PlannerResult<Vec<Expr>>>

Plans an overlay expression eg overlay(str PLACING substr FROM pos [FOR count])

Returns origin expression arguments if not possible

source

fn plan_make_map(&self, args: Vec<Expr>) -> Result<PlannerResult<Vec<Expr>>>

Plan a make_map expression, e.g., make_map(key1, value1, key2, value2, ...)

Returns origin expression arguments if not possible

source

fn plan_compound_identifier( &self, _field: &Field, _qualifier: Option<&TableReference>, _nested_names: &[String], ) -> Result<PlannerResult<Vec<Expr>>>

Plans compound identifier eg db.schema.table for non-empty nested names

Note: Currently compound identifier for outer query schema is not supported.

Returns planned expression

source

fn plan_any(&self, expr: RawBinaryExpr) -> Result<PlannerResult<RawBinaryExpr>>

Plans ANY expression, e.g., expr = ANY(array_expr)

Returns origin binary expression if not possible

Implementors§