Skip to main content

Module annotate_types

Module annotate_types 

Source
Expand description

Type annotation and coercion for SQL expressions Type Annotation for SQL Expressions

This module provides type inference and annotation for SQL AST nodes. It walks the expression tree and assigns data types to expressions based on:

  • Literal values (strings, numbers, booleans)
  • Column references (from schema)
  • Function return types
  • Operator result types (with coercion rules)

Based on SQLGlot’s optimizer/annotate_types.py

Structs§

TypeAnnotator
Type annotation configuration and state

Enums§

TypeCoercionClass
Type coercion class for determining result types in binary operations. Higher-priority classes win during coercion.

Functions§

annotate_types
Convenience function to annotate types in an expression tree