mz_sql

Module plan

Source
Expand description

SQL planning.

SQL planning is the process of taking the abstract syntax tree of a Statement and turning it into a Plan that the dataflow layer can execute.

Statements must be purified before they can be planned. See the pure module for details.

Modules§

  • error πŸ”’
  • explain πŸ”’
    EXPLAIN support for structures defined in this crate.
  • hir πŸ”’
    This file houses HIR, a representation of a SQL plan that is parallel to MIR, but represents an earlier phase of planning. It’s structurally very similar to MIR, with some differences which are noted below. It gets turned into MIR via a call to lower().
  • literal πŸ”’
  • lowering πŸ”’
    Lowering is the process of transforming a HirRelationExpr into a MirRelationExpr.
  • notice πŸ”’
  • plan_utils πŸ”’
    Helper code used throughout the planner.
  • query πŸ”’
    SQL Querys are the declarative, computational part of SQL. This module turns Querys into HirRelationExprs - a more explicit, algebraic way of describing computation. Functions named plan_* are typically responsible for handling a single node of the SQL ast. E.g. plan_query is responsible for handling sqlparser::ast::Query. plan_* functions which correspond to operations on relations typically return a HirRelationExpr. plan_* functions which correspond to operations on scalars typically return a HirScalarExpr and a ScalarType. (The latter is because it’s not always possible to infer from a HirScalarExpr what the intended type is - notably in the case of decimals where the scale/precision are encoded only in the type). Aggregates are particularly twisty.
  • scope πŸ”’
    Handles SQL’s scoping rules.
  • Support for side-effecting functions.
  • statement πŸ”’
    Statement planning.
  • transform_ast πŸ”’
    Transformations of SQL ASTs.
  • transform_hir πŸ”’
    Transformations of SQL IR, before decorrelation.
  • typeconv πŸ”’
    Maintains a catalog of valid casts between mz_repr::ScalarTypes, as well as other cast-related functions.
  • with_options πŸ”’
    Provides tooling to handle WITH options.

Structs§

Enums§

Functions§