pub trait RelationPlannerContext {
// Required methods
fn context_provider(&self) -> &dyn ContextProvider;
fn plan(&mut self, relation: TableFactor) -> Result<LogicalPlan>;
fn sql_to_expr(&mut self, expr: SQLExpr, schema: &DFSchema) -> Result<Expr>;
fn sql_expr_to_logical_expr(
&mut self,
expr: SQLExpr,
schema: &DFSchema,
) -> Result<Expr>;
fn normalize_ident(&self, ident: Ident) -> String;
fn object_name_to_table_reference(
&self,
name: ObjectName,
) -> Result<TableReference>;
// Provided method
fn get_cte(&self, _name: &TableReference) -> Option<&LogicalPlan> { ... }
}sql only.Expand description
Provides utilities for relation planners to interact with DataFusion’s SQL planner.
This trait provides SQL planning utilities specific to relation planning,
such as converting SQL expressions to logical expressions and normalizing
identifiers. It uses composition to provide access to session context via
ContextProvider.
Required Methods§
Sourcefn context_provider(&self) -> &dyn ContextProvider
fn context_provider(&self) -> &dyn ContextProvider
Provides access to the underlying context provider for reading session configuration, accessing tables, functions, and other metadata.
Sourcefn plan(&mut self, relation: TableFactor) -> Result<LogicalPlan>
fn plan(&mut self, relation: TableFactor) -> Result<LogicalPlan>
Plans the specified relation through the full planner pipeline, starting from the first registered relation planner.
Sourcefn sql_to_expr(&mut self, expr: SQLExpr, schema: &DFSchema) -> Result<Expr>
fn sql_to_expr(&mut self, expr: SQLExpr, schema: &DFSchema) -> Result<Expr>
Converts a SQL expression into a logical expression using the current planner context.
Sourcefn sql_expr_to_logical_expr(
&mut self,
expr: SQLExpr,
schema: &DFSchema,
) -> Result<Expr>
fn sql_expr_to_logical_expr( &mut self, expr: SQLExpr, schema: &DFSchema, ) -> Result<Expr>
Converts a SQL expression into a logical expression without DataFusion rewrites.
Sourcefn normalize_ident(&self, ident: Ident) -> String
fn normalize_ident(&self, ident: Ident) -> String
Normalizes an identifier according to session settings.
Sourcefn object_name_to_table_reference(
&self,
name: ObjectName,
) -> Result<TableReference>
fn object_name_to_table_reference( &self, name: ObjectName, ) -> Result<TableReference>
Normalizes a SQL object name into a TableReference.
Provided Methods§
Sourcefn get_cte(&self, _name: &TableReference) -> Option<&LogicalPlan>
fn get_cte(&self, _name: &TableReference) -> Option<&LogicalPlan>
Returns the common table expression (CTE) visible for the specified table reference in the current query scope, if any.
Relation planners run before DataFusion’s built-in relation planning. A
planner that recognizes ordinary tables by name can use this method to
pass a same-named relation to the remaining planners. When every
ordinary name-based planner does so, built-in CTE resolution is
preserved. Use Self::object_name_to_table_reference to normalize an
ObjectName before looking it up.
The lookup follows the same string-key matching as DataFusion’s built-in
relation planning, including for qualified table references. Different
TableReference variants with the same string representation therefore
use the same CTE lookup key.
The default implementation returns None for compatibility with custom
implementations of this context.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".