Skip to main content

Module semantic

Module semantic 

Source
Expand description

Semantic analysis: name resolution, type checking, and scope validation.

Validates AST nodes against a schema to ensure:

  • Column references resolve to known tables/columns
  • Table aliases are unique within a query scope
  • Function arity matches known functions
  • CTE names are visible in the correct scope
  • Type affinity is tracked for expression results

§Usage

let schema = Schema::new();
schema.add_table(TableDef { name: "users", columns: vec![...] });
let mut resolver = Resolver::new(&schema);
let errors = resolver.resolve_statement(&stmt);

Structs§

ColumnDef
A column definition in the schema.
Resolver
The semantic analyzer / name resolver.
Schema
The database schema: a collection of table definitions.
Scope
A name scope for query resolution. Scopes nest for subqueries and CTEs.
SemanticError
A semantic analysis error.
SemanticMetricsSnapshot
Point-in-time snapshot of semantic analysis metrics.
TableDef
A table definition in the schema.

Enums§

FunctionArity
Expected function arity.
ResolveResult
Result of resolving a column reference.
SemanticErrorKind
Kinds of semantic errors.

Functions§

reset_semantic_metrics
Reset semantic metrics.
semantic_metrics_snapshot
Take a point-in-time snapshot of semantic metrics.