Skip to main content

uqa_sql/
plan.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Complete SQL-to-execution-plan lowering.
8//!
9//! `OperatorTree` is the specialised algebra
10//! for posting-list, graph, and fusion operations.  It is intentionally not a
11//! relational algebra: forcing a SQL window frame or a mutation into a
12//! posting-list node would erase its row and command semantics.  This module
13//! supplies the missing super-plan.  Every SQL statement lowers to one
14//! [`UnifiedPlan`], while query-producing statements recursively own their
15//! relational children.  A physical driver can therefore use an
16//! `OperatorTree` as an access path *inside* a relational node without keeping
17//! a second top-level SQL dispatcher.
18
19use crate::ast::{
20    Expr, FrameBound, FromClause, NullsOrder, OrderBy, Projection, SelectStmt, SetOpKind,
21    Statement, WindowSpec, CTE,
22};
23use crate::ir::{ScalarExpr, ScalarFrameBound, ScalarOrder, ScalarWindowFrame, ScalarWindowSpec};
24
25mod command_children;
26pub mod input_projection;
27mod model;
28mod optimization;
29pub use optimization::ExecutablePlanOptimizer;
30mod query;
31mod rewrite;
32mod scalar;
33mod statement;
34pub mod subqueries;
35mod visit;
36pub mod windows;
37
38pub use model::*;
39pub use rewrite::rewrite_scalar_expression;
40
41#[cfg(test)]
42mod tests;
43
44mod projection;
45pub use projection::ProjectionTarget;
46
47pub mod source_projection;
48
49pub mod locking;