Expand description
Logical plan representation for query execution.
This module defines LogicalPlan, which represents the logical structure
of a query after parsing and semantic analysis. The logical plan is used
by the executor to produce query results.
§Plan Structure
Logical plans form a tree structure where:
- Leaf nodes are typically scans or DDL operations
- Internal nodes represent transformations (filter, sort, limit)
- DML operations (insert, update, delete) are also represented
§Examples
use alopex_sql::planner::logical_plan::LogicalPlan;
use alopex_sql::planner::{Projection, TypedExpr, TypedExprKind, SortExpr};
use alopex_sql::planner::types::ResolvedType;
use alopex_sql::Span;
// SELECT * FROM users ORDER BY name LIMIT 10
let scan = LogicalPlan::Scan {
table: "users".to_string(),
projection: Projection::All(vec!["id".to_string(), "name".to_string()]),
};
let sort = LogicalPlan::Sort {
input: Box::new(scan),
order_by: vec![SortExpr::asc(TypedExpr::column_ref(
"users".to_string(),
"name".to_string(),
1,
ResolvedType::Text,
Span::default(),
))],
};
let limit = LogicalPlan::Limit {
input: Box::new(sort),
limit: Some(10),
offset: None,
};Enums§
- Logical
Plan - Logical query plan representation.