pub struct MutableQueryPlan { /* private fields */ }Expand description
A private query destination with independently owned scalar fields and query children. Observation is read-only; consuming edits transfer or destroy the corresponding constructor records together with their IR.
Implementations§
Source§impl MutableQueryPlan
impl MutableQueryPlan
pub fn transform_scalar_arenas( self, control: &ProductionControl<'_>, transform: &mut ScalarArenaTransform<'_>, ) -> Result<Self, SQLError>
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn transfer_expression_to(
self,
destination: Self,
expression: OwnedScalarExpr,
control: &ProductionControl<'_>,
) -> Result<(Self, Self, OwnedScalarExpr, bool), SQLError>
pub fn transfer_expression_to( self, destination: Self, expression: OwnedScalarExpr, control: &ProductionControl<'_>, ) -> Result<(Self, Self, OwnedScalarExpr, bool), SQLError>
Transfer the detached expression’s exclusive query children into another query’s arena. Invalid or shared references leave all three private inputs unchanged. Successful movement preserves each child query’s own namespace and compacts only the source root’s indices.
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn prune_subqueries(
self,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn prune_subqueries( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Compact the local scalar-query arena through SQL’s existing namespace-aware remapping. Unreachable child payloads release before their constructor records, while the original arena capacity remains owned by the parent.
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn take_where(
self,
control: &ProductionControl<'_>,
) -> Result<(Self, Option<OwnedScalarExpr>), SQLError>
pub fn take_where( self, control: &ProductionControl<'_>, ) -> Result<(Self, Option<OwnedScalarExpr>), SQLError>
Detach WHERE with its independent scalar constructor. Its former field metadata remains with the query until another qualification is installed or the query is discarded.
Sourcepub fn projected(
projections: impl ExactSizeIterator<Item = OwnedProjection>,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn projected( projections: impl ExactSizeIterator<Item = OwnedProjection>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Build a projection query from independently admitted scalar/name inputs. The query starts without FROM; callers attach a unit or relational source through the same owning boundary.
Sourcepub fn replace_where(
self,
expression: Option<OwnedScalarExpr>,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn replace_where( self, expression: Option<OwnedScalarExpr>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Replace an optional qualification, transferring the selected scalar owner even when the query previously had no WHERE clause.
Sourcepub fn take_source(
self,
control: &ProductionControl<'_>,
) -> Result<(Self, Option<MutableSourcePlan>), SQLError>
pub fn take_source( self, control: &ProductionControl<'_>, ) -> Result<(Self, Option<MutableSourcePlan>), SQLError>
Move FROM out of the query while retaining every sibling field and its exact owner.
Sourcepub fn replace_source(
self,
source: Option<MutableSourcePlan>,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn replace_source( self, source: Option<MutableSourcePlan>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Replace FROM after admitting its new field records. The old source is destroyed before its constructor leases are retired.
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn map_cte(
self,
index: usize,
control: &ProductionControl<'_>,
map: impl FnOnce(MutableExecutablePlan) -> Result<MutableExecutablePlan, SQLError>,
) -> Result<Self, SQLError>
pub fn map_cte( self, index: usize, control: &ProductionControl<'_>, map: impl FnOnce(MutableExecutablePlan) -> Result<MutableExecutablePlan, SQLError>, ) -> Result<Self, SQLError>
Rewrite one CTE body while preserving its query/command kind and original declaration box. Its name, columns and scheduling metadata stay with the parent query.
Source§impl MutableQueryPlan
impl MutableQueryPlan
pub fn take_deferred_rewrites( self, control: &ProductionControl<'_>, ) -> Result<(Self, OwnedDeferredRewriteIter), SQLError>
pub fn replace_deferred_rewrites( self, rewrites: impl ExactSizeIterator<Item = Produced<DeferredOuterRewrite>>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Sourcepub fn transform_root_scalar_arenas(
self,
control: &ProductionControl<'_>,
transform: &mut ScalarArenaTransform<'_>,
) -> Result<Self, SQLError>
pub fn transform_root_scalar_arenas( self, control: &ProductionControl<'_>, transform: &mut ScalarArenaTransform<'_>, ) -> Result<Self, SQLError>
Edit block-owned roots while lending their scalar-query namespace. FROM expressions and nested query bodies retain their separate rewrite boundary.
pub fn map_source_with_arena( self, control: &ProductionControl<'_>, map: impl FnOnce(MutableSourcePlan, &mut ScalarQueryArena) -> Result<MutableSourcePlan, SQLError>, ) -> Result<Self, SQLError>
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn map_where_input(
self,
control: &ProductionControl<'_>,
map: impl FnOnce(Option<OwnedScalarExpr>, &mut ScalarQueryArena) -> Result<Option<OwnedScalarExpr>, SQLError>,
) -> Result<Self, SQLError>
pub fn map_where_input( self, control: &ProductionControl<'_>, map: impl FnOnce(Option<OwnedScalarExpr>, &mut ScalarQueryArena) -> Result<Option<OwnedScalarExpr>, SQLError>, ) -> Result<Self, SQLError>
Edit an optional WHERE clause together with its scalar-query namespace, including construction of a previously absent predicate.
Sourcepub fn take_where_expression(
self,
control: &ProductionControl<'_>,
) -> Result<(Self, Option<MutableExpressionPlan>), SQLError>
pub fn take_where_expression( self, control: &ProductionControl<'_>, ) -> Result<(Self, Option<MutableExpressionPlan>), SQLError>
Detach a WHERE clause with its complete original query namespace. Unreferenced namespaces remain with a query that has no WHERE clause.
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn map_value_rows<I: ExactSizeIterator<Item = OwnedScalarExpr>>(
self,
control: &ProductionControl<'_>,
map: impl FnMut(OwnedValueRow) -> Result<I, SQLError>,
) -> Result<Self, SQLError>
pub fn map_value_rows<I: ExactSizeIterator<Item = OwnedScalarExpr>>( self, control: &ProductionControl<'_>, map: impl FnMut(OwnedValueRow) -> Result<I, SQLError>, ) -> Result<Self, SQLError>
Transform VALUES rows through independently owned scalars while keeping the query namespace and metadata unchanged.
Sourcepub fn project_values(
self,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn project_values( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Keep the original query scope and scalar arena while exposing VALUES as an ordinary projection block. A single row becomes the projection list; multiple rows retain their buffers in a lateral captured source.
Source§impl MutableQueryPlan
impl MutableQueryPlan
pub fn apply_grouping( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Sourcepub fn discard_source_analysis(
self,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn discard_source_analysis( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Captured source layouts describe the pre-rewrite topology. Their immutable metadata retains its existing shared owner.
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn clear_row_analysis(
self,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn clear_row_analysis( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Drop cached row and source analysis after a structural input rewrite; query syntax and its independently owned fields remain intact.
pub fn append_row_lock( self, strength: LockStrength, wait: LockWait, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
pub fn set_privilege_subject( self, subject: Option<Produced<RoleReference>>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
pub fn clear_privilege_columns( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Sourcepub fn include_privilege_column(
self,
identity: Produced<ColumnIdentity>,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn include_privilege_column( self, identity: Produced<ColumnIdentity>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Retain one privilege dependency after admitting its tree node. Duplicate identities retain the original node and release the unused supplied identity.
Sourcepub fn set_compute(
self,
compute: ComputePlan,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn set_compute( self, compute: ComputePlan, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Change only the allocation-free compute decision chosen by the planner.
Sourcepub fn set_access(
self,
access: AccessPathPlan,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn set_access( self, access: AccessPathPlan, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Change only the allocation-free access decision chosen by the planner.
Sourcepub fn select_scalar(
self,
slot: QueryScalarSlot,
control: &ProductionControl<'_>,
) -> Result<Option<OwnedScalarExpr>, SQLError>
pub fn select_scalar( self, slot: QueryScalarSlot, control: &ProductionControl<'_>, ) -> Result<Option<OwnedScalarExpr>, SQLError>
Select one expression and destroy every other query allocation, including its former projection and parent containers. An absent optional field returns None.
Sourcepub fn replace_projection_alias(
self,
index: usize,
alias: Option<Produced<String>>,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn replace_projection_alias( self, index: usize, alias: Option<Produced<String>>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Replace a projection’s name without changing its scalar or positional descriptor. The new text arrives from an admitted producer; removed text is freed before its lease.
Source§impl MutableQueryPlan
impl MutableQueryPlan
pub fn transform_scalar_nodes( self, control: &ProductionControl<'_>, transform: &mut ScalarNodeTransform<'_>, ) -> Result<Self, SQLError>
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn rewrite_root_scalar_nodes(
self,
control: &ProductionControl<'_>,
replacement: &mut (dyn FnMut(&ScalarExpr) -> Result<Option<OwnedScalarExpr>, SQLError> + '_),
) -> Result<Self, SQLError>
pub fn rewrite_root_scalar_nodes( self, control: &ProductionControl<'_>, replacement: &mut (dyn FnMut(&ScalarExpr) -> Result<Option<OwnedScalarExpr>, SQLError> + '_), ) -> Result<Self, SQLError>
Rewrite local scalar nodes in source-first order without moving their original addresses. The observer receives read-only syntax and returns an independently owned replacement; nested queries retain separate traversal boundaries.
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn map_scalar_with_parent(
self,
slot: QueryScalarSlot,
control: &ProductionControl<'_>,
map: impl FnOnce(&QueryPlan, OwnedScalarExpr) -> Result<OwnedScalarExpr, SQLError>,
) -> Result<Self, SQLError>
pub fn map_scalar_with_parent( self, slot: QueryScalarSlot, control: &ProductionControl<'_>, map: impl FnOnce(&QueryPlan, OwnedScalarExpr) -> Result<OwnedScalarExpr, SQLError>, ) -> Result<Self, SQLError>
Rewrite a scalar with a read-only view of the enclosing query. The selected parent slot temporarily contains an allocation-free NULL; the callback receives its actual previous scalar and owner separately.
Sourcepub fn map_query_child_with_parent(
self,
slot: QueryChildSlot,
control: &ProductionControl<'_>,
map: impl FnOnce(&QueryPlan, Self) -> Result<Self, SQLError>,
) -> Result<Self, SQLError>
pub fn map_query_child_with_parent( self, slot: QueryChildSlot, control: &ProductionControl<'_>, map: impl FnOnce(&QueryPlan, Self) -> Result<Self, SQLError>, ) -> Result<Self, SQLError>
Observe an enclosing query’s namespace while rewriting one directly owned child. Its original box or arena entry stays allocated in the parent and holds an empty query until the callback returns.
Sourcepub fn map_source_with_parent(
self,
control: &ProductionControl<'_>,
map: impl FnOnce(&QueryPlan, MutableSourcePlan) -> Result<MutableSourcePlan, SQLError>,
) -> Result<Self, SQLError>
pub fn map_source_with_parent( self, control: &ProductionControl<'_>, map: impl FnOnce(&QueryPlan, MutableSourcePlan) -> Result<MutableSourcePlan, SQLError>, ) -> Result<Self, SQLError>
Observe the query’s scalar and analysis inputs while rewriting its source. FROM is temporarily absent; its complete original source is moved into the callback.
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn map_projection_inputs<I: ExactSizeIterator<Item = OwnedProjection>>(
self,
control: &ProductionControl<'_>,
map: impl FnOnce(OwnedProjectionIter, &mut ScalarQueryArena) -> Result<I, SQLError>,
) -> Result<Self, SQLError>
pub fn map_projection_inputs<I: ExactSizeIterator<Item = OwnedProjection>>( self, control: &ProductionControl<'_>, map: impl FnOnce(OwnedProjectionIter, &mut ScalarQueryArena) -> Result<I, SQLError>, ) -> Result<Self, SQLError>
Edit the projection list and its scalar-query namespace together, moving existing projection children without copying their payloads.
Sourcepub fn take_projections(
self,
control: &ProductionControl<'_>,
) -> Result<(Self, OwnedProjectionIter), SQLError>
pub fn take_projections( self, control: &ProductionControl<'_>, ) -> Result<(Self, OwnedProjectionIter), SQLError>
Move all projections into an owning iterator. The remaining query has an empty projection vector; its other constructors are unchanged.
Sourcepub fn replace_projections(
self,
projections: impl ExactSizeIterator<Item = OwnedProjection>,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn replace_projections( self, projections: impl ExactSizeIterator<Item = OwnedProjection>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Admit the destination vector and field records, then transfer each existing scalar and alias. Removed projections are freed before their old reservations.
Sourcepub fn set_analyzed_output(
self,
schema: Option<RowSchema>,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn set_analyzed_output( self, schema: Option<RowSchema>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Retain an already published immutable output descriptor without copying its columns or charging its shared owner again.
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn map_query_child(
self,
slot: QueryChildSlot,
control: &ProductionControl<'_>,
map: impl FnOnce(Self) -> Result<Self, SQLError>,
) -> Result<Self, SQLError>
pub fn map_query_child( self, slot: QueryChildSlot, control: &ProductionControl<'_>, map: impl FnOnce(Self) -> Result<Self, SQLError>, ) -> Result<Self, SQLError>
Rewrite a query child while retaining its original parent box or arena slot. A failed callback destroys the complete private parent and all untouched siblings.
Source§impl MutableQueryPlan
impl MutableQueryPlan
pub fn set_relations_bound( self, bound: bool, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn map_source(
self,
control: &ProductionControl<'_>,
map: impl FnOnce(MutableSourcePlan) -> Result<MutableSourcePlan, SQLError>,
) -> Result<Self, SQLError>
pub fn map_source( self, control: &ProductionControl<'_>, map: impl FnOnce(MutableSourcePlan) -> Result<MutableSourcePlan, SQLError>, ) -> Result<Self, SQLError>
Rewrite the complete FROM source without exposing a mutable query or separating a source from its constructor ownership.
Source§impl MutableQueryPlan
impl MutableQueryPlan
pub fn map_queries_while( self, control: &ProductionControl<'_>, visit: &mut (dyn FnMut(MutableQueryPlan) -> Result<(MutableQueryPlan, bool), SQLError> + '_), ) -> Result<Self, SQLError>
Source§impl MutableQueryPlan
impl MutableQueryPlan
Sourcepub fn replace_group_by(
self,
expressions: impl ExactSizeIterator<Item = OwnedScalarExpr>,
control: &ProductionControl<'_>,
) -> Result<Self, SQLError>
pub fn replace_group_by( self, expressions: impl ExactSizeIterator<Item = OwnedScalarExpr>, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Replace all grouping keys while preserving projection, source and grouping-set owners.
Source§impl MutableQueryPlan
impl MutableQueryPlan
pub fn normalize_window_definitions( self, control: &ProductionControl<'_>, ) -> Result<Self, SQLError>
Source§impl MutableQueryPlan
impl MutableQueryPlan
pub fn reserved_bytes(&self) -> usize
Sourcepub fn map_scalar(
self,
slot: QueryScalarSlot,
control: &ProductionControl<'_>,
map: impl FnOnce(OwnedScalarExpr) -> Result<OwnedScalarExpr, SQLError>,
) -> Result<Self, SQLError>
pub fn map_scalar( self, slot: QueryScalarSlot, control: &ProductionControl<'_>, map: impl FnOnce(OwnedScalarExpr) -> Result<OwnedScalarExpr, SQLError>, ) -> Result<Self, SQLError>
Rewrite one selected scalar root without copying parent containers or siblings. An absent optional scalar is left absent. Error or unwind destroys the complete private query.
Sourcepub fn retain_projections(
self,
control: &ProductionControl<'_>,
keep: impl FnMut(usize, &ProjectionPlan) -> Result<bool, SQLError>,
) -> Result<Self, SQLError>
pub fn retain_projections( self, control: &ProductionControl<'_>, keep: impl FnMut(usize, &ProjectionPlan) -> Result<bool, SQLError>, ) -> Result<Self, SQLError>
Keep selected projection entries in their original vector. Removed expression and alias storage is destroyed before its own constructor records; surviving aliases and scalar children keep their addresses and allowance.
Methods from Deref<Target = QueryPlan>§
Sourcepub fn copy_with_set_inputs(
&self,
left: OwnedQueryPlan,
right: OwnedQueryPlan,
control: &ProductionControl<'_>,
) -> Result<OwnedQueryPlan, SQLError>
pub fn copy_with_set_inputs( &self, left: OwnedQueryPlan, right: OwnedQueryPlan, control: &ProductionControl<'_>, ) -> Result<OwnedQueryPlan, SQLError>
Retain a set operation’s declarations and clauses while transferring both independently optimized query inputs.
Sourcepub fn copy_primary_with_control(
&self,
control: &ProductionControl<'_>,
) -> Result<Produced<Self>, SQLError>
pub fn copy_primary_with_control( &self, control: &ProductionControl<'_>, ) -> Result<Produced<Self>, SQLError>
Copy the primary query after its WITH definitions have been installed in the lexical scope. Excluded declarations are never allocated; all primary metadata and nested query scopes retain their meaning.
Sourcepub fn set_ordering_with_control(
&self,
control: &ProductionControl<'_>,
) -> Result<Produced<QueryBlockPlan>, SQLError>
pub fn set_ordering_with_control( &self, control: &ProductionControl<'_>, ) -> Result<Produced<QueryBlockPlan>, SQLError>
Produce the ordering/slicing block of a set operation without copying either operand. Scalar-query slots remain in the same order as their original expressions.
Sourcepub fn clone_with_control(
&self,
control: &ProductionControl<'_>,
) -> Result<Produced<Self>, SQLError>
pub fn clone_with_control( &self, control: &ProductionControl<'_>, ) -> Result<Produced<Self>, SQLError>
Copy a relational executable and its query/mutation CTEs, admitting destination capacities and owned payloads before allocation. Immutable analysis descriptors and retained row/literal identities remain shared.
Sourcepub fn copy_for_rewrite(
&self,
control: &ProductionControl<'_>,
) -> Result<MutableQueryPlan, SQLError>
pub fn copy_for_rewrite( &self, control: &ProductionControl<'_>, ) -> Result<MutableQueryPlan, SQLError>
Copy a complete query while keeping mutable constructor ownership separate. Every destination and ownership-record buffer is admitted before allocation; published immutable schemas retain their original shared owners.
pub fn visit_sources(&self, visit: &mut dyn FnMut(&SourcePlan))
Sourcepub fn visit_scalar_expressions(&self, visit: &mut dyn FnMut(&ScalarExpr))
pub fn visit_scalar_expressions(&self, visit: &mut dyn FnMut(&ScalarExpr))
Visit every scalar expression this query owns, each root once, including those of its CTEs, relational sources and scalar subqueries.
Sourcepub fn try_visit_scalar_expressions<'a, E>(
&'a self,
visit: &mut dyn FnMut(&'a ScalarExpr) -> Result<(), E>,
) -> Result<(), E>
pub fn try_visit_scalar_expressions<'a, E>( &'a self, visit: &mut dyn FnMut(&'a ScalarExpr) -> Result<(), E>, ) -> Result<(), E>
Stop at the first callback error, without copying syntax or visiting later inputs.
Trait Implementations§
Source§impl Debug for MutableQueryPlan
impl Debug for MutableQueryPlan
Auto Trait Implementations§
impl !RefUnwindSafe for MutableQueryPlan
impl !UnwindSafe for MutableQueryPlan
impl Freeze for MutableQueryPlan
impl Send for MutableQueryPlan
impl Sync for MutableQueryPlan
impl Unpin for MutableQueryPlan
impl UnsafeUnpin for MutableQueryPlan
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
impl<T> ErasedDestructor for Twhere
T: 'static,
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