Skip to main content

Module planner

Module planner 

Source
Expand description

Logical query planner.

Generates a logical execution plan (a DAG of Steps) from an optimized SQL AST. Inspired by Python sqlglot’s planner.py.

The planner sits between the optimizer and the executor: the optimizer rewrites the AST, then the planner produces a plan that an execution engine can follow.

§Example

use sqlglot_rust::parser::parse;
use sqlglot_rust::dialects::Dialect;
use sqlglot_rust::planner::{plan, Plan};

let ast = parse("SELECT a, b FROM t WHERE a > 1 ORDER BY b", Dialect::Ansi).unwrap();
let p = plan(&ast).unwrap();
println!("{}", p.to_mermaid());

Structs§

Plan
A logical execution plan — a directed acyclic graph (DAG) of steps.
Projection
A projected column in a plan step.
StepId
Opaque identifier for a step within a plan.

Enums§

Step
A single step in the logical execution plan.

Functions§

plan
Build a logical execution plan from a parsed SQL statement.