pub struct Planner<'a, C: Catalog> { /* private fields */ }Expand description
The SQL query planner.
The planner converts AST statements into logical plans. It performs:
- Name resolution: Validates table and column references
- Type checking: Infers and validates expression types
- Plan construction: Builds the logical plan tree
§Design Notes
- The planner uses an immutable reference to the catalog (
&C) - DDL statements produce plans but don’t modify the catalog
- The executor is responsible for applying catalog changes
§Examples
use alopex_sql::catalog::MemoryCatalog;
use alopex_sql::planner::Planner;
let catalog = MemoryCatalog::new();
let planner = Planner::new(&catalog);
// Parse and plan a statement
// let stmt = parser.parse("SELECT * FROM users")?;
// let plan = planner.plan(&stmt)?;Implementations§
Source§impl<'a, C: Catalog> Planner<'a, C>
impl<'a, C: Catalog> Planner<'a, C>
Sourcepub fn plan(&self, stmt: &Statement) -> Result<LogicalPlan, PlannerError>
pub fn plan(&self, stmt: &Statement) -> Result<LogicalPlan, PlannerError>
Plan a SQL statement.
This is the main entry point for converting an AST statement into a logical plan.
§Errors
Returns a PlannerError if:
- Referenced tables or columns don’t exist
- Type checking fails
- DDL validation fails (e.g., table already exists for CREATE TABLE)
Auto Trait Implementations§
impl<'a, C> Freeze for Planner<'a, C>
impl<'a, C> RefUnwindSafe for Planner<'a, C>where
C: RefUnwindSafe,
impl<'a, C> Send for Planner<'a, C>where
C: Sync,
impl<'a, C> Sync for Planner<'a, C>where
C: Sync,
impl<'a, C> Unpin for Planner<'a, C>
impl<'a, C> UnwindSafe for Planner<'a, C>where
C: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more