pub enum LogicalPlan {
Show 17 variants
Scan {
table: String,
alias: Option<String>,
limit: Option<usize>,
},
Filter {
input: Box<LogicalPlan>,
predicate: String,
},
Project {
input: Box<LogicalPlan>,
columns: Vec<String>,
},
Join {
left: Box<LogicalPlan>,
right: Box<LogicalPlan>,
on: String,
join_type: JoinType,
algo_hint: Option<JoinAlgoHint>,
},
Aggregate {
input: Box<LogicalPlan>,
group_by: Vec<String>,
aggregates: Vec<String>,
},
Sort {
input: Box<LogicalPlan>,
order_by: Vec<SortExpr>,
},
Limit {
input: Box<LogicalPlan>,
count: Option<u64>,
offset: Option<u64>,
},
Values {
columns: Vec<String>,
rows: usize,
},
Empty,
SetOp {
op: SetOpType,
all: bool,
left: Box<LogicalPlan>,
right: Box<LogicalPlan>,
},
Cte {
name: String,
query: Box<LogicalPlan>,
recursive: bool,
},
CteRef {
name: String,
},
Window {
input: Box<LogicalPlan>,
functions: Vec<WindowFunctionDef>,
},
Subquery {
query: Box<LogicalPlan>,
alias: Option<String>,
},
Exists {
subquery: Box<LogicalPlan>,
negated: bool,
},
InSubquery {
expr: String,
subquery: Box<LogicalPlan>,
negated: bool,
},
Compute {
input: Box<LogicalPlan>,
bindings: Vec<(String, String)>,
},
}Expand description
AST-level logical query plan produced by crate::plan_statement.
Each variant represents a relational algebra operator. The tree is
built bottom-up: leaf nodes (e.g. Scan) are wrapped by operator nodes
(Filter, Project, …) as query features are encountered.
Variants§
Scan
Table scan. alias is the AS alias, if any.
Fields
Filter
Row filter (WHERE).
Fields
input: Box<LogicalPlan>The plan being filtered.
Project
Column projection (SELECT col1, col2, …).
Fields
input: Box<LogicalPlan>The plan whose rows are projected.
Join
Binary join of two inputs.
Fields
left: Box<LogicalPlan>Left input.
right: Box<LogicalPlan>Right input.
algo_hint: Option<JoinAlgoHint>Algorithm hint set by crate::optimizer::JoinAlgorithmPass.
Aggregate
Aggregation (GROUP BY / aggregate functions).
Fields
input: Box<LogicalPlan>The plan whose rows are aggregated.
Sort
Row ordering (ORDER BY).
Fields
input: Box<LogicalPlan>The plan whose rows are sorted.
Limit
Row count / offset restriction (LIMIT … OFFSET …).
Fields
input: Box<LogicalPlan>The plan being limited.
Values
Constant row source (INSERT … VALUES …).
Fields
Empty
Placeholder for statements that produce no relational plan.
SetOp
A SQL set operation: UNION, INTERSECT, or EXCEPT.
Cte
A CTE definition node.
The query field is the plan for the CTE’s own defining body (AS (...)).
The query that uses this CTE is built by the surrounding planner; this
variant retains only the CTE definition itself.
Fields
query: Box<LogicalPlan>Plan for the CTE-defining sub-query (AS ( ... )).
CteRef
Reference to a previously defined CTE by name.
Window
Window-function layer sitting over a base plan.
Fields
input: Box<LogicalPlan>The input plan over which windows are computed.
functions: Vec<WindowFunctionDef>The window functions defined in the SELECT projection.
Subquery
A scalar subquery that returns a single value (used in SELECT or WHERE).
Fields
query: Box<LogicalPlan>The inner query plan.
Exists
EXISTS (subquery) — used in WHERE predicates.
Fields
subquery: Box<LogicalPlan>The inner subquery plan.
InSubquery
expr IN (subquery) — used in WHERE predicates.
Fields
subquery: Box<LogicalPlan>The inner subquery plan.
Compute
A plan node that materializes named expression bindings for CSE.
Each (alias, expr_string) pair in bindings declares a named
intermediate value that downstream nodes can reference by alias.
A Compute node is an optimization artifact introduced by the
common-subexpression-elimination pass; it adds zero compute overhead
and is transparent to most plan traversals.
Trait Implementations§
Source§impl Clone for LogicalPlan
impl Clone for LogicalPlan
Source§fn clone(&self) -> LogicalPlan
fn clone(&self) -> LogicalPlan
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more