This file houses a representation of a SQL plan that is parallel to that found in src/expr/relation/mod.rs, but represents an earlier phase of planning. It’s structurally very similar to that file, with some differences which are noted below. It gets turned into that representation via a call to lower().
Lowering is the process of transforming a
Helper code used throughout the planner.
Querys are the declarative, computational part of SQL. This module turns
HirRelationExprs - a more explicit, algebraic way of describing computation. Functions named plan_* are typically responsible for handling a single node of the SQL ast. Eg
plan_queryis 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
ScalarType. (The latter is because it’s not always possible to infer from a
HirScalarExprwhat the intended type is - notably in the case of decimals where the scale/precision are encoded only in the type). Aggregates are particularly twisty.
Handles SQL’s scoping rules.
Transformations of SQL ASTs.
Transformations of SQL IR, before decorrelation.
Maintains a catalog of valid casts between
mz_repr::ScalarTypes, as well as other cast-related functions.
Provides tooling to handle
ALTER ... IF EXISTSif the named object did not exist.
Configuration of introspection for a compute instance.
A vector of values to which parameter references should be bound.
Controls planning of a SQL query.
The state required when planning a
Immutable state that applies to the planning of an entire
Describes the output of a SQL statement.
Just like MirRelationExpr, except where otherwise noted below.
Just like mz_expr::MirScalarExpr, except where otherwise noted below.
Instructions for executing a SQL query.
Specifies how long a query will live. This impacts whether the query is allowed to reason about the time at which it is running, e.g., by calling the
Specifies when a
Settings related to storage hosts
A window function with its parameters.