datafusion_python::datafusion_expr::planner

Trait ExprPlanner

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

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>, DataFusionError>

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>>, DataFusionError>

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>>, DataFusionError>

Source

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

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>>, DataFusionError>

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>>, DataFusionError>

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>>, DataFusionError>

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>>, DataFusionError>

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>>, DataFusionError>

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>>, DataFusionError>

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>, DataFusionError>

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

Returns origin binary expression if not possible

Implementations on Foreign Types§

Source§

impl ExprPlanner for FieldAccessPlanner

Source§

impl ExprPlanner for NestedFunctionPlanner

Source§

impl ExprPlanner for CoreFunctionPlanner

Source§

impl ExprPlanner for UserDefinedFunctionPlanner

Implementors§