pub enum PlanNode {
Show 29 variants
SeqScan {
table: String,
},
AliasScan {
table: String,
alias: String,
},
IndexScan {
table: String,
column: String,
key: Expr,
},
RangeScan {
table: String,
column: String,
start: Option<(Expr, bool)>,
end: Option<(Expr, bool)>,
},
Filter {
input: Box<PlanNode>,
predicate: Expr,
},
Project {
input: Box<PlanNode>,
fields: Vec<ProjectField>,
},
Sort {
input: Box<PlanNode>,
keys: Vec<SortKey>,
},
Limit {
input: Box<PlanNode>,
count: Expr,
},
Offset {
input: Box<PlanNode>,
count: Expr,
},
Aggregate {
input: Box<PlanNode>,
function: AggFunc,
field: Option<String>,
},
NestedLoopJoin {
left: Box<PlanNode>,
right: Box<PlanNode>,
on: Option<Expr>,
kind: JoinKind,
},
Distinct {
input: Box<PlanNode>,
},
GroupBy {
input: Box<PlanNode>,
keys: Vec<String>,
aggregates: Vec<GroupAgg>,
having: Option<Expr>,
},
AlterTable {
table: String,
action: AlterAction,
},
DropTable {
name: String,
},
Insert {
table: String,
rows: Vec<Vec<Assignment>>,
},
Upsert {
table: String,
key_column: String,
assignments: Vec<Assignment>,
on_conflict: Vec<Assignment>,
},
Update {
input: Box<PlanNode>,
table: String,
assignments: Vec<Assignment>,
},
Delete {
input: Box<PlanNode>,
table: String,
},
CreateTable {
name: String,
fields: Vec<CreateField>,
},
CreateView {
name: String,
query_text: String,
},
RefreshView {
name: String,
},
DropView {
name: String,
},
Window {
input: Box<PlanNode>,
windows: Vec<WindowDef>,
},
Union {
left: Box<PlanNode>,
right: Box<PlanNode>,
all: bool,
},
Explain {
input: Box<PlanNode>,
},
Begin,
Commit,
Rollback,
}Expand description
Physical plan nodes — what the executor actually runs.
Variants§
SeqScan
AliasScan
Mission E1.2: sequential scan that renames output columns to
alias.field. Used exclusively as the leaves of a join plan so
downstream NestedLoopJoin + Filter + Project nodes can resolve
Expr::QualifiedField lookups by direct column-name match. Kept
separate from SeqScan so the single-table fast paths (which match
on PlanNode::SeqScan { .. } in many places) stay untouched.
IndexScan
RangeScan
B+tree range scan: returns rows where the indexed column falls within the given bounds. Generated by the planner when it detects inequality predicates (>, >=, <, <=, BETWEEN) on an indexed column. The executor falls back to SeqScan+Filter if no index exists on the column.
Fields
Filter
Project
Sort
Limit
Offset
Aggregate
NestedLoopJoin
Mission E1.2: nested-loop join. Correctness-first implementation —
O(L × R) scan for every join. E1.3 will add a hash-join fast path
for equijoins (the common case). The executor handles Inner,
Cross, and LeftOuter; RightOuter is rewritten by the planner
into a LeftOuter with swapped inputs.
Fields
Distinct
GroupBy
Mission E2b: grouped aggregation. Output columns are
keys ++ [agg.output_name for agg in aggregates]. The optional
having predicate is evaluated against each output row after
aggregation — it can reference both key columns and aggregate
output names (the planner rewrites FunctionCall nodes in the
HAVING expression into Field("__agg_N") references).
AlterTable
DropTable
Insert
Fields
rows: Vec<Vec<Assignment>>One assignment-block per row to insert. Always at least one.
Upsert
UPSERT: probe index on key_column — if miss, insert; if hit, update.
Update
Delete
CreateTable
CreateView
Create a materialized view: execute query, store results, register.
RefreshView
Explicitly refresh a materialized view.
DropView
Drop a materialized view (backing table + registry entry).
Window
Window function computation layer.
Union
UNION [ALL]: execute both sides, concatenate (ALL) or deduplicate.
Explain
EXPLAIN: format the inner plan tree as a text result without executing.