SqlToRel

Struct SqlToRel 

Source
pub struct SqlToRel<'a, S: ContextProvider> {
    pub(crate) context_provider: &'a S,
    pub(crate) options: ParserOptions,
    pub(crate) ident_normalizer: IdentNormalizer,
}
Expand description

SQL query planner and binder

This struct is used to convert a SQL AST into a LogicalPlan.

You can control the behavior of the planner by providing ParserOptions.

It performs the following tasks:

  1. Name and type resolution (called “binding” in other systems). This phase looks up table and column names using the ContextProvider.
  2. Mechanical translation of the AST into a LogicalPlan.

It does not perform type coercion, or perform optimization, which are done by subsequent passes.

Key interfaces are:

Fields§

§context_provider: &'a S§options: ParserOptions§ident_normalizer: IdentNormalizer

Implementations§

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(crate) fn plan_with_clause( &self, with: With, planner_context: &mut PlannerContext, ) -> Result<()>

Source

fn non_recursive_cte( &self, cte_query: Query, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Source

fn recursive_cte( &self, cte_name: String, cte_query: Query, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(crate) fn parse_sql_binary_op(&self, op: BinaryOperator) -> Result<Operator>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(super) fn sql_function_to_expr( &self, function: SQLFunction, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

pub(super) fn sql_fn_name_to_expr( &self, expr: SQLExpr, fn_name: &str, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

pub(super) fn find_window_func( &self, name: &str, ) -> Result<WindowFunctionDefinition>

Source

fn sql_fn_arg_to_logical_expr( &self, sql: FunctionArg, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

fn sql_fn_arg_to_logical_expr_with_name( &self, sql: FunctionArg, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<(Expr, Option<String>)>

Source

pub(super) fn function_args_to_expr( &self, args: Vec<FunctionArg>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Vec<Expr>>

Source

pub(super) fn function_args_to_expr_with_names( &self, args: Vec<FunctionArg>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<(Vec<Expr>, Vec<Option<String>>)>

Source

pub(crate) fn check_unnest_arg(arg: &Expr, schema: &DFSchema) -> Result<()>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(super) fn sql_grouping_sets_to_expr( &self, exprs: Vec<Vec<SQLExpr>>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

pub(super) fn sql_rollup_to_expr( &self, exprs: Vec<Vec<SQLExpr>>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

pub(super) fn sql_cube_to_expr( &self, exprs: Vec<Vec<SQLExpr>>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(super) fn sql_identifier_to_expr( &self, id: Ident, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

pub(crate) fn sql_compound_identifier_to_expr( &self, ids: Vec<Ident>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

pub(super) fn sql_case_identifier_to_expr( &self, operand: Option<Box<SQLExpr>>, conditions: Vec<CaseWhen>, else_result: Option<Box<SQLExpr>>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(crate) fn order_by_to_sort_expr( &self, order_by_exprs: Vec<OrderByExpr>, input_schema: &DFSchema, planner_context: &mut PlannerContext, literal_to_column: bool, additional_schema: Option<&DFSchema>, ) -> Result<Vec<SortExpr>>

Convert sql [OrderByExpr] to Vec<Expr>.

input_schema and additional_schema are used to resolve column references in the order-by expressions. input_schema is the schema of the input logical plan, typically derived from the SELECT list.

Usually order-by expressions can only reference the input plan’s columns. But the SELECT ... FROM ... ORDER BY ... syntax is a special case. Besides the input schema, it can reference an additional_schema derived from the FROM clause.

If literal_to_column is true, treat any numeric literals (e.g. 2) as a 1 based index into the SELECT list (e.g. SELECT a, b FROM table ORDER BY 2). Literals only reference the input_schema.

If false, interpret numeric literals as constant values.

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(super) fn parse_exists_subquery( &self, subquery: Query, negated: bool, input_schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

pub(super) fn parse_in_subquery( &self, expr: SQLExpr, subquery: Query, negated: bool, input_schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

pub(super) fn parse_scalar_subquery( &self, subquery: Query, input_schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

fn validate_single_column( &self, sub_plan: &LogicalPlan, spans: Spans, error_message: &str, help_message: &str, ) -> Result<()>

Source

fn build_multi_column_diagnostic( &self, spans: Spans, error_message: &str, help_message: &str, ) -> Diagnostic

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(super) fn sql_substring_to_expr( &self, expr: Box<SQLExpr>, substring_from: Option<Box<SQLExpr>>, substring_for: Option<Box<SQLExpr>>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(crate) fn parse_sql_unary_op( &self, op: UnaryOperator, expr: SQLExpr, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(crate) fn parse_value( &self, value: Value, param_data_types: &[FieldRef], ) -> Result<Expr>

Source

pub(super) fn parse_sql_number( &self, unsigned_number: &str, negative: bool, ) -> Result<Expr>

Parse number in sql string, convert to Expr::Literal

Source

fn create_placeholder_expr( param: String, param_data_types: &[FieldRef], ) -> Result<Expr>

Create a placeholder expression This is the same as Postgres’s prepare statement syntax in which a placeholder starts with $ sign and then number 1, 2, … etc. For example, $1 is the first placeholder; $2 is the second one and so on.

Source

pub(super) fn sql_array_literal( &self, elements: Vec<SQLExpr>, schema: &DFSchema, ) -> Result<Expr>

Source

fn try_plan_array_literal( &self, values: Vec<Expr>, schema: &DFSchema, ) -> Result<Expr>

Source

pub(super) fn sql_interval_to_expr( &self, negative: bool, interval: Interval, ) -> Result<Expr>

Convert a SQL interval expression to a DataFusion logical plan expression

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(crate) fn sql_expr_to_logical_expr_with_alias( &self, sql: SQLExprWithAlias, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

pub(crate) fn sql_expr_to_logical_expr( &self, sql: SQLExpr, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

fn build_logical_expr( &self, op: BinaryOperator, left: Expr, right: Expr, schema: &DFSchema, ) -> Result<Expr>

Source

pub fn sql_to_expr_with_alias( &self, sql: SQLExprWithAlias, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

pub fn sql_to_expr( &self, sql: SQLExpr, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Generate a relational expression from a SQL expression

Source

fn rewrite_partial_qualifier(&self, expr: Expr, schema: &DFSchema) -> Expr

Rewrite aliases which are not-complete (e.g. ones that only include only table qualifier in a schema.table qualified relation)

Source

fn sql_expr_to_logical_expr_internal( &self, sql: SQLExpr, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Internal implementation. Use Self::sql_expr_to_logical_expr to plan exprs.

Source

fn parse_struct( &self, schema: &DFSchema, planner_context: &mut PlannerContext, values: Vec<SQLExpr>, fields: Vec<StructField>, ) -> Result<Expr>

Parses a struct(..) expression and plans it creation

Source

fn parse_tuple( &self, schema: &DFSchema, planner_context: &mut PlannerContext, values: Vec<SQLExpr>, ) -> Result<Expr>

Source

fn sql_position_to_expr( &self, substr_expr: SQLExpr, str_expr: SQLExpr, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

fn try_plan_dictionary_literal( &self, fields: Vec<DictionaryField>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

fn try_plan_map_literal( &self, entries: Vec<MapEntry>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

fn create_named_struct_expr( &self, values: Vec<SQLExpr>, input_schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Vec<Expr>>

Source

fn create_struct_expr( &self, values: Vec<SQLExpr>, input_schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Vec<Expr>>

Source

fn sql_in_list_to_expr( &self, expr: SQLExpr, list: Vec<SQLExpr>, negated: bool, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

fn sql_like_to_expr( &self, negated: bool, expr: SQLExpr, pattern: SQLExpr, escape_char: Option<Value>, schema: &DFSchema, planner_context: &mut PlannerContext, case_insensitive: bool, any: bool, ) -> Result<Expr>

Source

fn sql_similarto_to_expr( &self, negated: bool, expr: SQLExpr, pattern: SQLExpr, escape_char: Option<Value>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

fn sql_trim_to_expr( &self, expr: SQLExpr, trim_where: Option<TrimWhereField>, trim_what: Option<Box<SQLExpr>>, trim_characters: Option<Vec<SQLExpr>>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

fn sql_overlay_to_expr( &self, expr: SQLExpr, overlay_what: SQLExpr, overlay_from: SQLExpr, overlay_for: Option<Box<SQLExpr>>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

fn sql_cast_to_expr( &self, expr: SQLExpr, data_type: SQLDataType, format: Option<CastFormat>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source

fn extract_root_and_access_chain( &self, root: SQLExpr, access_chain: Vec<AccessExpr>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<(Expr, Vec<AccessExpr>)>

Extracts the root expression and access chain from a compound expression.

This function attempts to identify if a compound expression (like a.b.c) should be treated as a column reference with a qualifier (like table.column) or as a field access expression.

§Arguments
  • root - The root SQL expression (e.g., the first part of a.b.c)
  • access_chain - Vector of access expressions (e.g., .b and .c parts)
  • schema - The schema to resolve column references against
  • planner_context - Context for planning expressions
§Returns

A tuple containing:

  • The resolved root expression
  • The remaining access chain that should be processed as field accesses
Source

fn sql_compound_field_access_to_expr( &self, root: SQLExpr, access_chain: Vec<AccessExpr>, schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr>

Source§

impl<'a, S: ContextProvider> SqlToRel<'a, S>

Source

pub fn new(context_provider: &'a S) -> Self

Create a new query planner.

The query planner derives the parser options from the context provider.

Source

pub fn new_with_options(context_provider: &'a S, options: ParserOptions) -> Self

Create a new query planner with the given parser options.

The query planner ignores the parser options from the context provider and uses the given parser options instead.

Source

pub fn build_schema(&self, columns: Vec<SQLColumnDef>) -> Result<Schema>

Source

pub(crate) fn build_column_defaults( &self, columns: &Vec<SQLColumnDef>, planner_context: &mut PlannerContext, ) -> Result<Vec<(String, Expr)>>

Returns a vector of (column_name, default_expr) pairs

Source

pub(crate) fn apply_table_alias( &self, plan: LogicalPlan, alias: TableAlias, ) -> Result<LogicalPlan>

Apply the given TableAlias to the input plan

Source

pub(crate) fn apply_expr_alias( &self, plan: LogicalPlan, idents: Vec<Ident>, ) -> Result<LogicalPlan>

Source

pub(crate) fn validate_schema_satisfies_exprs( &self, schema: &DFSchema, exprs: &[Expr], ) -> Result<()>

Validate the schema provides all of the columns referenced in the expressions.

Source

pub(crate) fn convert_data_type_to_field( &self, sql_type: &SQLDataType, ) -> Result<FieldRef>

Source

fn convert_simple_data_type(&self, sql_type: &SQLDataType) -> Result<DataType>

Source

pub(crate) fn object_name_to_table_reference( &self, object_name: ObjectName, ) -> Result<TableReference>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(crate) fn query_to_plan( &self, query: Query, outer_planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Generate a logical plan from an SQL query/subquery

Source

fn pipe_operators( &self, plan: LogicalPlan, pipe_operators: Vec<PipeOperator>, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Apply pipe operators to a plan

Source

fn pipe_operator( &self, plan: LogicalPlan, pipe_operator: PipeOperator, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Apply a pipe operator to a plan

Source

fn pipe_operator_set( &self, plan: LogicalPlan, set_operator: SetOperator, set_quantifier: SetQuantifier, queries: Vec<Query>, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Handle Union/Intersect/Except pipe operators

Source

fn limit( &self, input: LogicalPlan, limit_clause: Option<LimitClause>, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Wrap a plan in a limit

Source

pub(crate) fn order_by( &self, plan: LogicalPlan, order_by: Vec<Sort>, ) -> Result<LogicalPlan>

Wrap the logical in a sort

Source

fn pipe_operator_aggregate( &self, plan: LogicalPlan, full_table_exprs: Vec<ExprWithAliasAndOrderBy>, group_by_expr: Vec<ExprWithAliasAndOrderBy>, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Handle AGGREGATE pipe operator

Source

fn select_into( &self, plan: LogicalPlan, select_into: Option<SelectInto>, ) -> Result<LogicalPlan>

Wrap the logical plan in a SelectInto

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(crate) fn plan_table_with_joins( &self, t: TableWithJoins, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Source

pub(crate) fn parse_relation_join( &self, left: LogicalPlan, join: Join, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Source

fn parse_cross_join( &self, left: LogicalPlan, right: LogicalPlan, ) -> Result<LogicalPlan>

Source

fn parse_join( &self, left: LogicalPlan, right: LogicalPlan, constraint: JoinConstraint, join_type: JoinType, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

fn create_relation( &self, relation: TableFactor, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Create a LogicalPlan that scans the named relation

Source

pub(crate) fn create_relation_subquery( &self, subquery: TableFactor, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(crate) fn select_to_plan( &self, select: Select, query_order_by: Option<OrderBy>, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Generate a logic plan from an SQL select

Source

pub(crate) fn try_process_unnest( &self, input: LogicalPlan, select_exprs: Vec<Expr>, ) -> Result<LogicalPlan>

Try converting Expr(Unnest(Expr)) to Projection/Unnest/Projection

Source

fn try_process_aggregate_unnest( &self, input: LogicalPlan, ) -> Result<LogicalPlan>

Source

fn try_process_group_by_unnest( &self, agg: Aggregate, ) -> Result<(LogicalPlan, Vec<Expr>)>

Try converting Unnest(Expr) of group by to Unnest/Projection. Return the new input and group_by_exprs of Aggregate. Select exprs can be different from agg exprs, for example:

Source

pub(crate) fn plan_selection( &self, selection: Option<SQLExpr>, plan: LogicalPlan, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Source

pub(crate) fn plan_from_tables( &self, from: Vec<TableWithJoins>, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Source

pub(crate) fn prepare_select_exprs( &self, plan: &LogicalPlan, projection: Vec<SelectItem>, empty_from: bool, planner_context: &mut PlannerContext, ) -> Result<Vec<SelectExpr>>

Returns the Expr’s corresponding to a SQL query’s SELECT expressions.

Source

fn sql_select_to_rex( &self, sql: SelectItem, plan: &LogicalPlan, empty_from: bool, planner_context: &mut PlannerContext, ) -> Result<SelectExpr>

Generate a relational expression from a select SQL expression

Source

fn check_wildcard_options(options: &WildcardAdditionalOptions) -> Result<()>

Source

fn plan_wildcard_options( &self, plan: &LogicalPlan, empty_from: bool, planner_context: &mut PlannerContext, options: WildcardAdditionalOptions, ) -> Result<WildcardOptions>

If there is a REPLACE statement in the projected expression in the form of “REPLACE (some_column_within_an_expr AS some_column)”, we should plan the replace expressions first.

Source

pub(crate) fn project( &self, input: LogicalPlan, expr: Vec<SelectExpr>, ) -> Result<LogicalPlan>

Wrap a plan in a projection

Source

fn aggregate( &self, input: &LogicalPlan, select_exprs: &[Expr], having_expr_opt: Option<&Expr>, qualify_expr_opt: Option<&Expr>, group_by_exprs: &[Expr], aggr_exprs: &[Expr], ) -> Result<(LogicalPlan, Vec<Expr>, Option<Expr>, Option<Expr>)>

Create an aggregate plan.

An aggregate plan consists of grouping expressions, aggregate expressions, an optional HAVING expression (which is a filter on the output of the aggregate), and an optional QUALIFY clause which may reference aggregates.

§Arguments
  • input - The input plan that will be aggregated. The grouping, aggregate, and “having” expressions must all be resolvable from this plan.
  • select_exprs - The projection expressions from the SELECT clause.
  • having_expr_opt - Optional HAVING clause.
  • qualify_expr_opt - Optional QUALIFY clause.
  • group_by_exprs - Grouping expressions from the GROUP BY clause. These can be column references or more complex expressions.
  • aggr_exprs - Aggregate expressions, such as SUM(a) or COUNT(1).
§Return

The return value is a quadruplet of the following items:

  • plan - A LogicalPlan::Aggregate plan for the newly created aggregate.
  • select_exprs_post_aggr - The projection expressions rewritten to reference columns from the aggregate
  • having_expr_post_aggr - The “having” expression rewritten to reference a column from the aggregate
  • qualify_expr_post_aggr - The “qualify” expression rewritten to reference a column from the aggregate
Source

fn match_window_definitions( &self, projection: &mut [SelectItem], named_windows: &[NamedWindowDefinition], ) -> Result<()>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(crate) fn set_expr_to_plan( &self, set_expr: SetExpr, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Source

pub(crate) fn is_union_all(set_quantifier: SetQuantifier) -> Result<bool>

Source

fn validate_set_expr_num_of_columns( &self, op: SetOperator, left_span: Option<Span>, right_span: Option<Span>, left_plan: &LogicalPlan, right_plan: &LogicalPlan, set_expr_span: Option<Span>, ) -> Result<()>

Source

pub(crate) fn set_operation_to_plan( &self, op: SetOperator, left_plan: LogicalPlan, right_plan: LogicalPlan, set_quantifier: SetQuantifier, ) -> Result<LogicalPlan>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub fn statement_to_plan(&self, statement: DFStatement) -> Result<LogicalPlan>

Generate a logical plan from an DataFusion SQL statement

Source

pub fn sql_statement_to_plan(&self, statement: Statement) -> Result<LogicalPlan>

Generate a logical plan from an SQL statement

Source

pub fn sql_statement_to_plan_with_context( &self, statement: Statement, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Generate a logical plan from an SQL statement

Source

fn sql_statement_to_plan_with_context_impl( &self, statement: Statement, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Source

fn get_delete_target(&self, from: FromTable) -> Result<ObjectName>

Source

fn show_tables_to_plan(&self) -> Result<LogicalPlan>

Generate a logical plan from a “SHOW TABLES” query

Source

fn describe_table_to_plan(&self, table_name: ObjectName) -> Result<LogicalPlan>

Source

fn describe_query_to_plan(&self, query: Query) -> Result<LogicalPlan>

Source

fn copy_to_plan(&self, statement: CopyToStatement) -> Result<LogicalPlan>

Source

fn build_order_by( &self, order_exprs: Vec<Vec<OrderByExpr>>, schema: &DFSchemaRef, planner_context: &mut PlannerContext, ) -> Result<Vec<Vec<SortExpr>>>

Source

fn external_table_to_plan( &self, statement: CreateExternalTable, ) -> Result<LogicalPlan>

Generate a logical plan from a CREATE EXTERNAL TABLE statement

Source

fn get_constraint_column_indices( &self, df_schema: &DFSchemaRef, columns: &[IndexColumn], constraint_name: &str, ) -> Result<Vec<usize>>

Get the indices of the constraint columns in the schema. If any column is not found, return an error.

Source

pub fn new_constraint_from_table_constraints( &self, constraints: &[TableConstraint], df_schema: &DFSchemaRef, ) -> Result<Constraints>

Convert each [TableConstraint] to corresponding Constraint

Source

fn parse_options_map( &self, options: Vec<(String, Value)>, allow_duplicates: bool, ) -> Result<HashMap<String, String>>

Source

fn explain_to_plan( &self, verbose: bool, analyze: bool, format: Option<String>, statement: DFStatement, ) -> Result<LogicalPlan>

Generate a plan for EXPLAIN … that will print out a plan

Note this is the sqlparser explain statement, not the datafusion EXPLAIN statement.

Source

fn show_variable_to_plan(&self, variable: &[Ident]) -> Result<LogicalPlan>

Source

fn set_statement_to_plan(&self, statement: Set) -> Result<LogicalPlan>

Source

fn delete_to_plan( &self, table_name: ObjectName, predicate_expr: Option<SQLExpr>, ) -> Result<LogicalPlan>

Source

fn update_to_plan( &self, table: TableWithJoins, assignments: Vec<Assignment>, from: Option<TableWithJoins>, predicate_expr: Option<SQLExpr>, ) -> Result<LogicalPlan>

Source

fn insert_to_plan( &self, table_name: ObjectName, columns: Vec<Ident>, source: Box<Query>, overwrite: bool, replace_into: bool, ) -> Result<LogicalPlan>

Source

fn show_columns_to_plan( &self, extended: bool, full: bool, sql_table_name: ObjectName, ) -> Result<LogicalPlan>

Source

fn show_functions_to_plan( &self, filter: Option<ShowStatementFilter>, ) -> Result<LogicalPlan>

Rewrite SHOW FUNCTIONS to another SQL query The query is based on the information_schema.routines and information_schema.parameters tables

The output columns:

  • function_name: The name of function
  • return_type: The return type of the function
  • parameters: The name of parameters (ordered by the ordinal position)
  • parameter_types: The type of parameters (ordered by the ordinal position)
  • description: The description of the function (the description defined in the document)
  • syntax_example: The syntax_example of the function (the syntax_example defined in the document)
Source

fn show_create_table_to_plan( &self, sql_table_name: ObjectName, ) -> Result<LogicalPlan>

Source

fn has_table(&self, schema: &str, table: &str) -> bool

Return true if there is a table provider available for “schema.table”

Source

fn validate_transaction_kind( &self, kind: Option<BeginTransactionKind>, ) -> Result<()>

Source§

impl<S: ContextProvider> SqlToRel<'_, S>

Source

pub(crate) fn sql_values_to_plan( &self, values: SQLValues, planner_context: &mut PlannerContext, ) -> Result<LogicalPlan>

Auto Trait Implementations§

§

impl<'a, S> Freeze for SqlToRel<'a, S>

§

impl<'a, S> RefUnwindSafe for SqlToRel<'a, S>
where S: RefUnwindSafe,

§

impl<'a, S> Send for SqlToRel<'a, S>
where S: Sync,

§

impl<'a, S> Sync for SqlToRel<'a, S>
where S: Sync,

§

impl<'a, S> Unpin for SqlToRel<'a, S>

§

impl<'a, S> UnwindSafe for SqlToRel<'a, S>
where S: RefUnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

§

impl<T> ErasedDestructor for T
where T: 'static,