Trait mz_sql_parser::ast::metadata::AstInfo
source · pub trait AstInfo: Clone {
type NestedStatement: AstDisplay + Clone + Hash + Debug + Eq;
type ItemName: AstDisplay + Clone + Hash + Debug + Eq + Ord;
type ColumnReference: AstDisplay + Clone + Hash + Debug + Eq + Ord;
type SchemaName: AstDisplay + Clone + Hash + Debug + Eq + Ord;
type DatabaseName: AstDisplay + Clone + Hash + Debug + Eq + Ord;
type ClusterName: AstDisplay + Clone + Hash + Debug + Eq + Ord;
type DataType: AstDisplay + Clone + Hash + Debug + Eq + Ord;
type CteId: Clone + Hash + Debug + Eq + Ord;
type RoleName: AstDisplay + Clone + Hash + Debug + Eq + Ord;
type NetworkPolicyName: AstDisplay + Clone + Hash + Debug + Eq + Ord;
type ObjectName: AstDisplay + Clone + Hash + Debug + Eq + Ord;
}
Expand description
This represents the metadata that lives next to an AST, as we take it through various stages in the planning process.
Conceptually, when we first receive an AST from the parsing process, it only
represents the syntax that the user input, and has no semantic information
embedded in it. Later in this process, we want to be able to walk the tree
and add additional information to it piecemeal, perhaps without going down
the full planning pipeline. AstInfo represents various bits of information
that get stored in the tree: for instance, at first, table names are only
represented by the names the user input (in the Raw
implementor of this
trait), but later on, we replace them with both the name along with the ID
that it gets resolved to.
Currently this process brings an Ast<Raw>
to Ast<Aug>
, and lives in
sql/src/names.rs:resolve.
Required Associated Types§
sourcetype NestedStatement: AstDisplay + Clone + Hash + Debug + Eq
type NestedStatement: AstDisplay + Clone + Hash + Debug + Eq
The type used for nested statements.
sourcetype ItemName: AstDisplay + Clone + Hash + Debug + Eq + Ord
type ItemName: AstDisplay + Clone + Hash + Debug + Eq + Ord
The type used for item references. Items are the subset of objects that are namespaced by a database and schema.
sourcetype ColumnReference: AstDisplay + Clone + Hash + Debug + Eq + Ord
type ColumnReference: AstDisplay + Clone + Hash + Debug + Eq + Ord
The type used to specify a column.
n.b. when implementing visitors, you likely want to build the visitor to
visit crate::ast::ColumnName
instead of visiting this struct
directly. The visitor on this should usually just return an error.
sourcetype SchemaName: AstDisplay + Clone + Hash + Debug + Eq + Ord
type SchemaName: AstDisplay + Clone + Hash + Debug + Eq + Ord
The type used for schema names.
sourcetype DatabaseName: AstDisplay + Clone + Hash + Debug + Eq + Ord
type DatabaseName: AstDisplay + Clone + Hash + Debug + Eq + Ord
The type used for database names.
sourcetype ClusterName: AstDisplay + Clone + Hash + Debug + Eq + Ord
type ClusterName: AstDisplay + Clone + Hash + Debug + Eq + Ord
The type used for cluster names.
sourcetype CteId: Clone + Hash + Debug + Eq + Ord
type CteId: Clone + Hash + Debug + Eq + Ord
The type stored next to CTEs for their assigned ID.
sourcetype NetworkPolicyName: AstDisplay + Clone + Hash + Debug + Eq + Ord
type NetworkPolicyName: AstDisplay + Clone + Hash + Debug + Eq + Ord
The type used for network policy references.
sourcetype ObjectName: AstDisplay + Clone + Hash + Debug + Eq + Ord
type ObjectName: AstDisplay + Clone + Hash + Debug + Eq + Ord
They type used for any object names. Objects are the superset of all objects in Materialize.