Struct datafusion_sql::planner::PlannerContext
source · pub struct PlannerContext { /* private fields */ }
Expand description
Struct to store the states used by the Planner. The Planner will leverage the states to resolve CTEs, Views, subqueries and PREPARE statements. The states include Common Table Expression (CTE) provided with WITH clause and Parameter Data Types provided with PREPARE statement and the query schema of the outer query plan
§Cloning
Only the ctes
are truly cloned when the PlannerContext
is cloned. This helps resolve
scoping issues of CTEs. By using cloning, a subquery can inherit CTEs from the outer query
and can also define its own private CTEs without affecting the outer query.
Implementations§
source§impl PlannerContext
impl PlannerContext
sourcepub fn with_prepare_param_data_types(
self,
prepare_param_data_types: Vec<DataType>,
) -> Self
pub fn with_prepare_param_data_types( self, prepare_param_data_types: Vec<DataType>, ) -> Self
Update the PlannerContext with provided prepare_param_data_types
pub fn outer_query_schema(&self) -> Option<&DFSchema>
sourcepub fn set_outer_query_schema(
&mut self,
schema: Option<DFSchemaRef>,
) -> Option<DFSchemaRef>
pub fn set_outer_query_schema( &mut self, schema: Option<DFSchemaRef>, ) -> Option<DFSchemaRef>
sets the outer query schema, returning the existing one, if any
sourcepub fn prepare_param_data_types(&self) -> &[DataType]
pub fn prepare_param_data_types(&self) -> &[DataType]
Return the types of parameters ($1
, $2
, etc) if known
sourcepub fn contains_cte(&self, cte_name: &str) -> bool
pub fn contains_cte(&self, cte_name: &str) -> bool
returns true if there is a Common Table Expression (CTE) / Subquery for the specified name
sourcepub fn insert_cte(&mut self, cte_name: impl Into<String>, plan: LogicalPlan)
pub fn insert_cte(&mut self, cte_name: impl Into<String>, plan: LogicalPlan)
Inserts a LogicalPlan for the Common Table Expression (CTE) / Subquery for the specified name
sourcepub fn get_cte(&self, cte_name: &str) -> Option<&LogicalPlan>
pub fn get_cte(&self, cte_name: &str) -> Option<&LogicalPlan>
Return a plan for the Common Table Expression (CTE) / Subquery for the specified name
Trait Implementations§
source§impl Clone for PlannerContext
impl Clone for PlannerContext
source§fn clone(&self) -> PlannerContext
fn clone(&self) -> PlannerContext
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for PlannerContext
impl Debug for PlannerContext
Auto Trait Implementations§
impl Freeze for PlannerContext
impl !RefUnwindSafe for PlannerContext
impl Send for PlannerContext
impl Sync for PlannerContext
impl Unpin for PlannerContext
impl !UnwindSafe for PlannerContext
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)