1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
//
// Unified Query Algebra
//
// Copyright (c) 2023-2026 Cognica, Inc.
//
//! 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.
use crate::ast::{
Expr, FrameBound, FromClause, NullsOrder, OrderBy, Projection, SelectStmt, SetOpKind,
Statement, WindowSpec, CTE,
};
use crate::ir::{ScalarExpr, ScalarFrameBound, ScalarOrder, ScalarWindowFrame, ScalarWindowSpec};
mod command_children;
mod model;
mod optimization;
pub use optimization::ExecutablePlanOptimizer;
mod query;
mod rewrite;
mod scalar;
mod statement;
pub mod subqueries;
mod visit;
pub mod windows;
pub use model::*;
pub use rewrite::rewrite_scalar_expression;
#[cfg(test)]
mod tests;
mod projection;
pub use projection::ProjectionTarget;
pub mod source_projection;
pub mod locking;