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
pub fn set_table_schema( &mut self, schema: Option<DFSchemaRef>, ) -> Option<DFSchemaRef>
pub fn table_schema(&self) -> Option<DFSchemaRef>
pub fn outer_from_schema(&self) -> Option<Arc<DFSchema>>
Sourcepub fn set_outer_from_schema(
&mut self,
schema: Option<DFSchemaRef>,
) -> Option<DFSchemaRef>
pub fn set_outer_from_schema( &mut self, schema: Option<DFSchemaRef>, ) -> Option<DFSchemaRef>
Sets the outer FROM schema, returning the existing one, if any
Sourcepub fn extend_outer_from_schema(&mut self, schema: &DFSchemaRef) -> Result<()>
pub fn extend_outer_from_schema(&mut self, schema: &DFSchemaRef) -> Result<()>
Extends the FROM 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§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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