mz_sql_parser::ast::metadata

Trait 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 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§

Source

type NestedStatement: AstDisplay + Clone + Hash + Debug + Eq

The type used for nested statements.

Source

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.

Source

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 vist crate::ast::ColumnName instead of visiting this struct directly. The visitor on this should usually just return an error.

Source

type SchemaName: AstDisplay + Clone + Hash + Debug + Eq + Ord

The type used for schema names.

Source

type DatabaseName: AstDisplay + Clone + Hash + Debug + Eq + Ord

The type used for database names.

Source

type ClusterName: AstDisplay + Clone + Hash + Debug + Eq + Ord

The type used for cluster names.

Source

type DataType: AstDisplay + Clone + Hash + Debug + Eq + Ord

The type used for data types.

Source

type CteId: Clone + Hash + Debug + Eq + Ord

The type stored next to CTEs for their assigned ID.

Source

type RoleName: AstDisplay + Clone + Hash + Debug + Eq + Ord

The type used for role references.

Source

type ObjectName: AstDisplay + Clone + Hash + Debug + Eq + Ord

They type used for any object names. Objects are the superset of all objects in Materialize.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§