Expand description
Complete SQL-to-execution-plan lowering.
OperatorTree is the specialised algebra
for posting-list, graph, and fusion operations. It is intentionally not a
relational algebra: forcing a SQL window frame or a mutation into a
posting-list node would erase its row and command semantics. This module
supplies the missing super-plan. Every SQL statement lowers to one
UnifiedPlan, while query-producing statements recursively own their
relational children. A physical driver can therefore use an
OperatorTree as an access path inside a relational node without keeping
a second top-level SQL dispatcher.
Modules§
- input_
projection - Substitute analyzed input expressions without evaluating their values.
- locking
- Canonical relation row marks selected by SQL locking analysis.
- source_
projection - Required SQL source columns and explicitly requested relation metadata.
- subqueries
- Compact scalar-subquery arenas after expression rewrites discard inputs.
- windows
- Canonical window clauses own analyzed inputs; expanded call specifications are derived copies.
Structs§
- Analyzed
Source - Input schemas from one ordered analysis, sharing immutable row metadata. Join children preserve their own namespaces before the join’s aliases and USING projection.
- Assignment
Plan - Conflict
Plan - CteCycle
Plan - Generated cycle mark and path columns for a recursive CTE.
- CtePlan
- A named query child owned by a
QueryPlan. - CteSearch
Plan - Generated traversal-order column for a recursive CTE.
- Delete
Plan - Executable
Memory - Allocation leases transferred with an executable. The root box is kept separate so projecting an unboxed query releases exactly that allocation, while attached child roots become ordinary tree storage.
- Expression
Plan - Executable scalar IR plus every query-valued descendant it owns.
- Insert
Plan - Merge
Plan - Mutable
Command Plan - Mutable
Expression Plan - Mutable
Join Parts - Mutable
Join Shell - Mutable
Query Plan - 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.
- Mutable
Source Plan - A source whose child and scalar constructor records follow consuming edits.
- Order
Plan - Owned
Deferred Rewrite Iter - Owned
Executable Plan - An executable and the reservations transferred by its allocation owners. Moving an existing input into this owner performs no allocation and does not retroactively charge that input. Native producers must admit their new allocations before transferring them. The tree is read-only after publication; preparation that constructs additional storage must retain its output reservations too.
- Owned
Projection - Owned
Projection Iter - Owned
Query Plan - A relational executable projected from its statement owner. Retaining the original root box avoids copying its payload or releasing a charged box while its reservation is still attached to the query.
- Owned
Scalar Children - Moves immediate scalar children in copy order without copying their payloads or allocating a work queue. Unvisited children and the original parent containers remain owned until exhaustion or iterator destruction.
- Owned
Scalar Expr - A scalar expression whose child allocations can be transferred or discarded independently. The expression is read-only outside this owner’s consuming operations; replacing raw IR through a mutable dereference would separate allocations from their reservations.
- Owned
Value Row - Projection
Plan - Query
Block Plan - One SELECT block after
WITHand set-operation structure has been pulled into explicit parent/child nodes. - Query
Plan - A relational query with its CTE scope and one relational root.
- Retained
CtePlan - Retained
Query Arena - Rule
Values Input - The target values and private DEFAULT flags carried by a rewritten VALUES input.
- Scalar
Query Arena - A private scalar-query namespace. Its syntax and constructor records move together; observers can borrow children while only owning operations can add them.
- Shared
Analyzed Source - Shared
Executable Plan - Shared immutable execution storage. Keeping the Arc private prevents unwrapping its payload while leaving the shared allocation’s reservation attached to an unboxed value.
- Table
Function Plan - One independently resolved and bound function inside a range-function group.
- Update
Plan - View
Check Plan - View
Rule Insert Plan - View
Rule Returning Plan - View
Rule Update Plan
Enums§
- Access
Path Plan - Cross-paradigm access decision made after the relational and scalar portions of a query block have both been lowered.
- Command
Assignment Slot - Command
Plan - Non-query statement plans. Mutations own physical sources and scalar IR; query-bearing catalog commands own explicit query children. Typed DDL and procedural payloads contain catalog data, never a second SQL dispatcher.
- Command
Query Slot - Command
Scalar Slot - Compute
Plan - The SELECT-list phase chosen during lowering.
- Conflict
Action Plan - CtePlan
Body - A relational CTE or a command whose RETURNING relation feeds its consumers.
- Join
Execution Strategy - Physical strategy selected for a relational join.
- Merge
When Plan - Mutable
Executable Plan - PlanRef
- A statement root borrowed from either a complete plan or a utility’s relational child. Borrowing does not copy the child or assert that its analysis or optimization has run.
- Projection
Target - Identity assigned to one projection result. SQL columns participate in
ordinary name binding and wildcard expansion; internal attributes are
executor-only
resjunkslots addressed structurally. - Query
Child Slot - A directly retained query child. Each child keeps its own scalar-subquery namespace.
- Query
Scalar Slot - A scalar root in one query’s own expression namespace. Nested sources and query children retain separate owners.
- Relational
Plan - Relational nodes common to ordinary SQL, retrieval SQL, and table/graph functions.
- Source
Child Slot - Source
Plan - The row-producing source below a query block.
- Source
Scalar Slot - Unified
Plan - One fully lowered SQL statement.
Traits§
- Aggregate
Classifier - Classification hook for engine-registered aggregate functions. Built-in aggregates are always recognised; the callback extends that set without making the planner depend on the engine.
- Executable
Plan Optimizer - Analyze and optimize a logical plan using metadata captured for this call.
- Owned
Scoped Plan Visitor - Scoped
Plan Visitor - Hooks receive the enclosing CTE namespace, using decoded, unqualified names. A command’s own definitions are not enclosing names. Returning false leaves its children unvisited.
Functions§
- rewrite_
scalar_ expression - Visit one scalar-expression tree in post-order and rewrite each node once.