Documentation
¶
Overview ¶
Package sqlengine parses, generates and analyzes SQL across Bruin's dialects: tokenizer, expression tree, per-dialect parser and generator, transforms, scope analysis, schema, optimizer rules (qualify, type annotation, simplification, subquery unnesting/merging, ...) and column lineage.
It is a Go port of the Python library sqlglot (v30.13.0, MIT licensed; see LICENSE.sqlglot), which Bruin previously embedded. The port keeps sqlglot's structure and naming so it can be compared against the Python source and upgraded mechanically: `_parse_table_parts` is parseTableParts, `table_sql` is tableSQL, dialect overrides live in d_<dialect>*.go. Pure-data tables (token types, expression classes, dialect settings, type mappings) are generated from the Python objects by codegen/gen.py into zz_*.go.
Supported dialects: the base dialect (""), athena, bigquery, clickhouse, databricks, doris, duckdb, fabric, hive, mysql, oracle, postgres, presto, redshift, snowflake, spark, spark2, sqlite, starrocks, trino and tsql.
Conformance is verified against sqlglot's own test-suite corpus (see conformance_*_test.go and codegen/README.md): tokens, full parse trees and regenerated SQL match Python exactly.
Errors: entry points return ParseError, TokenError, ValueError, OptimizeError, SchemaError or UnsupportedError values whose messages match sqlglot's. Where sqlglot itself fails with a plain Python exception (AttributeError, KeyError, ...), a ValueError carrying the same message is used.
The package is safe for concurrent use; dialect prototypes are built once and shared read-only.
Index ¶
- Constants
- Variables
- func DataTypeIsType(dt *Expr, dtypes []any, checkNullable bool) bool
- func ExprString(e *Expr) string
- func FindAllInScope(expression *Expr, kinds ...Kind) iter.Seq[*Expr]
- func JoinCondition(join *Expr) ([]*Expr, []*Expr, *Expr)
- func LineageAll(expression *Expr, opts LineageOptions) (names []string, nodes map[string]*LineageNode, err error)
- func NormalizationDistance(expression *Expr, dnf bool, maxDistance int) int
- func Normalized(expression *Expr, dnf bool) bool
- func PivotOutputColumns(p *Expr, prePivotColumns []string) *omap[string]
- func PushdownCTEAliasColumns(scope *Scope)
- func PyLower(s string) string
- func PyRepr(s string) string
- func PyUpper(s string) string
- func QualifyOutputs(expression *Expr, dialect *Dialect)
- func QualifyOutputsScope(scope *Scope, dialect *Dialect)
- func ReplaceChildren(expression *Expr, fn func(*Expr) any)
- func WalkInScope(expression *Expr, prune func(*Expr) bool) iter.Seq[*Expr]
- type AnnotateOptions
- type DType
- type DTypeSet
- type Dialect
- func (d *Dialect) CanQuote(id *Expr, identify string) bool
- func (d *Dialect) CaseSensitive(text string) bool
- func (d *Dialect) Generate(e *Expr, opts *GenerateOptions) (string, error)
- func (d *Dialect) GenerateOwned(e *Expr, opts *GenerateOptions) (string, error)
- func (d *Dialect) Is(name string) bool
- func (d *Dialect) NewGenerator(opts *GenerateOptions) *Generator
- func (d *Dialect) NewParser(opts *ParseOptions) *Parser
- func (d *Dialect) NormalizeIdentifier(e *Expr) *Expr
- func (d *Dialect) Parse(sql string, opts *ParseOptions) ([]*Expr, error)
- func (d *Dialect) ParseOne(sql string, opts *ParseOptions) (*Expr, error)
- func (d *Dialect) ParseOneInto(kind Kind, sql string, opts *ParseOptions) (*Expr, error)
- func (d *Dialect) QuoteIdentifier(e *Expr, identify bool) *Expr
- func (d *Dialect) Tokenize(sql string) ([]*Token, error)
- func (d *Dialect) TokenizeScript(sql string) ([]*Token, error)
- type DialectSettings
- type ErrorLevel
- type Expr
- func AliasExpr(expression *Expr, alias any, quoted *bool, copy bool) *Expr
- func AliasTableExpr(expression *Expr, alias any, columns []any, quoted *bool, copy bool) *Expr
- func AliasWithQuote(e *Expr, name string, quoted bool) *Expr
- func AndExpr(expressions ...*Expr) *Expr
- func AndExprOpts(expressions []*Expr, copy bool, wrap bool) *Expr
- func AnnotateTypes(expression *Expr, o AnnotateOptions) *Expr
- func ArrayExpr(expressions []*Expr, copy bool) *Expr
- func Boolean(b bool) *Expr
- func Canonicalize(expression *Expr, d *Dialect) *Expr
- func CaseExpr(expression *Expr, copy bool) *Expr
- func CastExpr(expression *Expr, to any, copy bool, d *Dialect) *Expr
- func CastToType(e *Expr, typ string) *Expr
- func ColumnExpr(col any, table, db, catalog any, fields []any, quoted *bool, copy bool) *Expr
- func ConditionExpr(expression *Expr, copy bool) *Expr
- func DataTypeBuild(dtype any, d *Dialect, udt bool, copy bool) *Expr
- func DataTypeFromStr(dtype string, dialect *Dialect, udt bool) *Expr
- func DotBuild(exprs []*Expr) *Expr
- func EliminateCTEs(expression *Expr) *Expr
- func EliminateJoins(expression *Expr) *Expr
- func EliminateSubqueries(expression *Expr) *Expr
- func ExceptExpr(expressions []*Expr, distinct bool, copy bool) *Expr
- func FindInScope(expression *Expr, kinds ...Kind) *Expr
- func FromArgList(kind Kind, args []*Expr) *Expr
- func FromExpr(expression *Expr) *Expr
- func IntersectExpr(expressions []*Expr, distinct bool, copy bool) *Expr
- func IsolateTableSelects(expression *Expr, schema *MappingSchema, d *Dialect) *Expr
- func LiteralInt(i int) *Expr
- func LiteralNumber(s string) *Expr
- func LiteralString(s string) *Expr
- func MaybeParse(sql string, into Kind, prefix string, d *Dialect) *Expr
- func MergeCTEs(expression *Expr, leaveTablesIsolated bool) *Expr
- func MergeDerivedTables(expression *Expr, leaveTablesIsolated bool) *Expr
- func MergeSubqueries(expression *Expr, leaveTablesIsolated bool) *Expr
- func New(kind Kind, kv ...any) *Expr
- func NewCTE(body *Expr, name string) *Expr
- func NewDataType(d DType) *Expr
- func NormalizeCNF(expression *Expr, dnf bool, maxDistance int) *Expr
- func NormalizeIdentifiers(e *Expr, d *Dialect) *Expr
- func NormalizeIdentifiersFull(e *Expr, d *Dialect, storeOriginalColumnIdentifiers bool) *Expr
- func NormalizeIdentifiersStr(name string, d *Dialect) *Expr
- func NotExpr(expression *Expr, copy bool) *Expr
- func Null() *Expr
- func Optimize(e *Expr, schema *MappingSchema, d *Dialect, rules []OptimizerRule) *Expr
- func OptimizeJoins(expression *Expr) *Expr
- func OptimizeSafe(e *Expr, schema *SchemaMap, d *Dialect, rules []OptimizerRule) (out *Expr, err error)
- func OptimizeWith(e *Expr, ctx *OptimizeContext, rules []OptimizerRule) *Expr
- func OrExpr(expressions ...*Expr) *Expr
- func OrExprOpts(expressions []*Expr, copy bool, wrap bool) *Expr
- func Paren(e *Expr) *Expr
- func ParenExpr(expression *Expr, copy bool) *Expr
- func PushdownPredicates(expression *Expr, d *Dialect) *Expr
- func PushdownProjections(expression *Expr, schema *MappingSchema, removeUnusedSelections bool, ...) *Expr
- func Qualify(expression *Expr, o QualifyOptions) *Expr
- func QualifyColumns(expression *Expr, schema *MappingSchema, expandAliasRefs, expandStars bool, ...) *Expr
- func QualifyDerivedTableOutputsTSQL(expression *Expr) *Expr
- func QualifyTables(expression *Expr, db, catalog string, onQualify func(table *Expr), d *Dialect, ...) *Expr
- func QueryLimitBuild(q *Expr, n int, d *Dialect) (out *Expr, err error)
- func QueryLimitBuildOwned(q *Expr, n int, d *Dialect) (out *Expr, err error)
- func QueryWithBuild(q *Expr, name, sql string, d *Dialect) (out *Expr, err error)
- func QuoteIdentifiers(expression *Expr, d *Dialect, identify bool) *Expr
- func ReorderJoins(expression *Expr) *Expr
- func ReplaceTree(expression *Expr, fn func(*Expr) *Expr, prune func(*Expr) bool) *Expr
- func SelectExpr(expressions ...*Expr) *Expr
- func SelectReplaceProjections(sel *Expr, projection *Expr) *Expr
- func Simplify(e *Expr, o SimplifyOptions) *Expr
- func SimplifyParens(expression *Expr, d *Dialect) *Expr
- func Star() *Expr
- func SubqueryExpr(expression *Expr, alias any, copy bool) *Expr
- func TableExpr(table, db, catalog any, quoted *bool, alias any) *Expr
- func ToIdentifier(name string, quoted *bool) *Expr
- func ToIdentifierAny(name any, quoted *bool, copy bool) *Expr
- func TupleExpr(expressions []*Expr, copy bool) *Expr
- func UnionExpr(expressions []*Expr, distinct bool, copy bool) *Expr
- func UnnestSubqueries(expression *Expr) *Expr
- func ValidateQualifyColumns(expression *Expr, sql string) *Expr
- func VarChecked(name string) *Expr
- func VarExpr(name string) *Expr
- func VarOf(e *Expr) *Expr
- func WithValidateArgs(e *Expr, args []*Expr) *Expr
- func XorExpr(expressions ...*Expr) *Expr
- func XorExprOpts(expressions []*Expr, copy bool, wrap bool) *Expr
- func (e *Expr) AddComments(comments []string, prepend bool)
- func (e *Expr) Alias() string
- func (e *Expr) AliasColumnNames() []string
- func (e *Expr) AliasOrName() string
- func (e *Expr) Append(key string, value *Expr)
- func (e *Expr) Arg(key string) any
- func (e *Expr) ArgB(key string) bool
- func (e *Expr) ArgE(key string) *Expr
- func (e *Expr) ArgKey() string
- func (e *Expr) ArgKeys() []string
- func (e *Expr) ArgL(key string) []*Expr
- func (e *Expr) ArgS(key string) string
- func (e *Expr) BFS(prune func(*Expr) bool) iter.Seq[*Expr]
- func (e *Expr) CTEs() []*Expr
- func (e *Expr) CatalogName() string
- func (e *Expr) Comments() []string
- func (e *Expr) Copy() *Expr
- func (e *Expr) DFS(prune func(*Expr) bool) iter.Seq[*Expr]
- func (e *Expr) DTypeOf() DType
- func (e *Expr) DbName() string
- func (e *Expr) DeleteArg(key string) any
- func (e *Expr) Depth() int
- func (e *Expr) Equal(o *Expr) bool
- func (e *Expr) ErrorMessages(args []*Expr) []string
- func (e *Expr) ExprAnd(expressions []*Expr, copy bool, wrap bool) *Expr
- func (e *Expr) ExprAs(alias any, quoted *bool, copy bool) *Expr
- func (e *Expr) ExprNot(copy bool) *Expr
- func (e *Expr) ExprOr(expressions []*Expr, copy bool, wrap bool) *Expr
- func (e *Expr) Expression() *Expr
- func (e *Expr) Expressions() []*Expr
- func (e *Expr) Find(kinds ...Kind) *Expr
- func (e *Expr) FindAll(kinds ...Kind) iter.Seq[*Expr]
- func (e *Expr) FindAllDFS(kinds ...Kind) iter.Seq[*Expr]
- func (e *Expr) FindAllList(kinds ...Kind) []*Expr
- func (e *Expr) FindAncestor(kinds ...Kind) *Expr
- func (e *Expr) Flatten(unnest bool) []*Expr
- func (e *Expr) HasArgKey(key string) bool
- func (e *Expr) Hash() uint64
- func (e *Expr) Index() int
- func (e *Expr) Is(kind Kind) bool
- func (e *Expr) IsA(kinds ...Kind) bool
- func (e *Expr) IsInt() bool
- func (e *Expr) IsLeaf() bool
- func (e *Expr) IsNumber() bool
- func (e *Expr) IsSemiOrAntiJoin() bool
- func (e *Expr) IsStar() bool
- func (e *Expr) IsString() bool
- func (e *Expr) IsTypeOf(dtypes ...any) bool
- func (e *Expr) IsWrapper() bool
- func (e *Expr) IterExpressions(reverse bool) []*Expr
- func (e *Expr) JoinOn(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) JoinUsing(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) Key() string
- func (e *Expr) Kind() Kind
- func (e *Expr) KindText() string
- func (e *Expr) Left() *Expr
- func (e *Expr) Meta() map[string]any
- func (e *Expr) MetaGet(key string) any
- func (e *Expr) MethodText() string
- func (e *Expr) Name() string
- func (e *Expr) NamedSelects() []string
- func (e *Expr) OutputName() string
- func (e *Expr) Own() *Expr
- func (e *Expr) Parent() *Expr
- func (e *Expr) ParentSelect() *Expr
- func (e *Expr) Parts() []*Expr
- func (e *Expr) Pop() *Expr
- func (e *Expr) PopComments() []string
- func (e *Expr) QueryExcept(expressions []*Expr, distinct bool, copy bool) *Expr
- func (e *Expr) QueryIntersect(expressions []*Expr, distinct bool, copy bool) *Expr
- func (e *Expr) QueryLimit(expression *Expr, copy bool) *Expr
- func (e *Expr) QueryOffset(expression *Expr, copy bool) *Expr
- func (e *Expr) QueryOrderBy(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) QuerySelect(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) QuerySubquery(alias any, copy bool) *Expr
- func (e *Expr) QueryUnion(expressions []*Expr, distinct bool, copy bool) *Expr
- func (e *Expr) QueryWhere(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) QueryWith(alias, as *Expr, recursive, materialized any, appendMode bool, copy bool, ...) *Expr
- func (e *Expr) RawType() *Expr
- func (e *Expr) Replace(expression *Expr) *Expr
- func (e *Expr) ReplaceWithList(list []*Expr)
- func (e *Expr) Right() *Expr
- func (e *Expr) Root() *Expr
- func (e *Expr) SQL(dialect string, opts *GenerateOptions) (string, error)
- func (e *Expr) SameParent() bool
- func (e *Expr) SelectClusterBy(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) SelectDistinct(ons []*Expr, distinct bool, copy bool) *Expr
- func (e *Expr) SelectFrom(expression *Expr, copy bool) *Expr
- func (e *Expr) SelectGroupBy(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) SelectHaving(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) SelectHint(hints []*Expr, copy bool) *Expr
- func (e *Expr) SelectJoin(expression *Expr, on []*Expr, using []*Expr, appendMode bool, joinType string, ...) *Expr
- func (e *Expr) SelectLateral(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) SelectLock(update bool, copy bool) *Expr
- func (e *Expr) SelectQualify(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) SelectSortBy(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) SelectWindow(expressions []*Expr, appendMode bool, copy bool) *Expr
- func (e *Expr) Selects() []*Expr
- func (e *Expr) Set(key string, value any)
- func (e *Expr) SetArgRaw(key string, value any)
- func (e *Expr) SetComments(c []string)
- func (e *Expr) SetIndex(key string, value any, index int, overwrite bool)
- func (e *Expr) SetKwargs(kv ...any) *Expr
- func (e *Expr) SetType(dt *Expr)
- func (e *Expr) SetTypeAny(dtype any)
- func (e *Expr) SetTypeD(d DType)
- func (e *Expr) SideText() string
- func (e *Expr) TableAliasColumns() []*Expr
- func (e *Expr) TableName() string
- func (e *Expr) Text(key string) string
- func (e *Expr) This() *Expr
- func (e *Expr) ThisS() string
- func (e *Expr) ToDot(includeDots bool) *Expr
- func (e *Expr) Transform(fn func(*Expr) *Expr, copy bool) *Expr
- func (e *Expr) Type() *Expr
- func (e *Expr) Unalias() *Expr
- func (e *Expr) Unnest() *Expr
- func (e *Expr) UnnestOperands() []*Expr
- func (e *Expr) UnnestSubquery() *Expr
- func (e *Expr) UnnestSubqueryOrParen() *Expr
- func (e *Expr) Unwrap() *Expr
- func (e *Expr) Walk(bfs bool, prune func(*Expr) bool) iter.Seq[*Expr]
- type ExprMetadata
- type ExprMetadataType
- type FuncBuilder
- type GenFunc
- type GenerateOptions
- type Generator
- type GeneratorData
- type GeneratorSettings
- type Kind
- type KindSet
- type LineageError
- type LineageNode
- type LineageOptions
- type MappingSchema
- func (s *MappingSchema) AddTable(table *Expr, columnMapping *SchemaMap, dialect *Dialect, normalize *bool, ...)
- func (s *MappingSchema) ColumnNames(table *Expr, onlyVisible bool, dialect *Dialect, normalize *bool) []string
- func (s *MappingSchema) Depth() int
- func (s *MappingSchema) Dialect() *Dialect
- func (s *MappingSchema) Empty() bool
- func (s *MappingSchema) Find(table *Expr, raiseOnMissing bool, ensureDataTypes bool) *SchemaMap
- func (s *MappingSchema) GetColumnType(table *Expr, column *Expr, columnName string, dialect *Dialect, ...) *Expr
- func (s *MappingSchema) GetUDFType(udf *Expr, dialect *Dialect, normalize *bool) *Expr
- func (s *MappingSchema) HasColumn(table *Expr, column *Expr, columnName string, dialect *Dialect, ...) bool
- func (s *MappingSchema) SupportedTableArgs() []string
- func (s *MappingSchema) TableFromString(name string, dialect *Dialect) *Expr
- type OptimizeContext
- type OptimizeError
- type OptimizerRule
- type OptionsType
- type ParseError
- type ParseErrorDetail
- type ParseOptions
- type Parser
- type ParserData
- type ParserSettings
- type QualifyOptions
- type Resolver
- func (r *Resolver) AllColumns() StrSet
- func (r *Resolver) Dialect() *Dialect
- func (r *Resolver) GetSourceColumns(name string, onlyVisible bool) []string
- func (r *Resolver) GetSourceColumnsFromSetOp(expression *Expr) []string
- func (r *Resolver) GetTable(column *Expr) *Expr
- func (r *Resolver) GetTableByName(columnName string) *Expr
- type SchemaError
- type SchemaMap
- type Scope
- func (s *Scope) AddSource(name string, src Source)
- func (s *Scope) Branch(expression *Expr, scopeType ScopeType, ...) *Scope
- func (s *Scope) CTEs() []*Expr
- func (s *Scope) ClearCache()
- func (s *Scope) ColumnIndex() map[*Expr]struct{}
- func (s *Scope) Columns() []*Expr
- func (s *Scope) DerivedTables() []*Expr
- func (s *Scope) ExternalColumns() []*Expr
- func (s *Scope) Find(kinds ...Kind) *Expr
- func (s *Scope) FindAll(kinds ...Kind) iter.Seq[*Expr]
- func (s *Scope) IsCTE() bool
- func (s *Scope) IsCorrelatedSubquery() bool
- func (s *Scope) IsDerivedTable() bool
- func (s *Scope) IsRoot() bool
- func (s *Scope) IsSubquery() bool
- func (s *Scope) IsUDTF() bool
- func (s *Scope) IsUnion() bool
- func (s *Scope) JoinHints() []*Expr
- func (s *Scope) LocalColumns() []*Expr
- func (s *Scope) Pivots() []*Expr
- func (s *Scope) RefCount() map[any]int
- func (s *Scope) References() []scopeRef
- func (s *Scope) RemoveSource(name string)
- func (s *Scope) RenameSource(oldName, newName string)
- func (s *Scope) Replace(old, new *Expr)
- func (s *Scope) ScansAllSubscopeColumns() bool
- func (s *Scope) SelectedSources() *omap[SelectedSource]
- func (s *Scope) SemiOrAntiJoinTables() StrSet
- func (s *Scope) SourceColumns(sourceName string) []*Expr
- func (s *Scope) Stars() []*Expr
- func (s *Scope) Subqueries() []*Expr
- func (s *Scope) TableColumns() []*Expr
- func (s *Scope) Tables() []*Expr
- func (s *Scope) Traverse() []*Scope
- func (s *Scope) UDTFs() []*Expr
- func (s *Scope) UnqualifiedColumns() []*Expr
- func (s *Scope) Walk(prune func(*Expr) bool) iter.Seq[*Expr]
- type ScopeType
- type SelectedSource
- type Simplifier
- func (s *Simplifier) AbsorbAndEliminate(expression *Expr, root bool) *Expr
- func (s *Simplifier) Dialect() *Dialect
- func (s *Simplifier) RemoveComplements(expression *Expr, root bool) *Expr
- func (s *Simplifier) RewriteBetween(expression *Expr) *Expr
- func (s *Simplifier) Simplify(expression *Expr, constantPropagation, coalesceSimplification bool) *Expr
- func (s *Simplifier) SimplifyCoalesce(expression *Expr) *Expr
- func (s *Simplifier) SimplifyComparison(expression, left, right *Expr, or bool) *Expr
- func (s *Simplifier) SimplifyConcat(expression *Expr) *Expr
- func (s *Simplifier) SimplifyConditionals(expression *Expr) *Expr
- func (s *Simplifier) SimplifyConnectors(expression *Expr, root bool) *Expr
- func (s *Simplifier) SimplifyDatetrunc(expression *Expr) *Expr
- func (s *Simplifier) SimplifyEquality(expression *Expr) *Expr
- func (s *Simplifier) SimplifyLiterals(expression *Expr, root bool) *Expr
- func (s *Simplifier) SimplifyNot(expression *Expr) *Expr
- func (s *Simplifier) SimplifyStartswith(expression *Expr) *Expr
- func (s *Simplifier) SortComparison(expression *Expr) *Expr
- func (s *Simplifier) UniqSort(expression *Expr, root bool) *Expr
- type SimplifyOptions
- type Source
- type StrSet
- type Token
- type TokenError
- type TokenSet
- type TokenType
- type TokenizerSettings
- type Tri
- type TypeAnnotator
- type UnsupportedError
- type ValueError
Constants ¶
const ( HIVE_TIME_FORMAT = "'yyyy-MM-dd HH:mm:ss'" HIVE_DATE_FORMAT = "'yyyy-MM-dd'" HIVE_DATEINT_FORMAT = "'yyyyMMdd'" )
These constants are duplicated from the Hive dialect class to avoid circular imports. They must be kept in sync with Hive.TIME_FORMAT, Hive.DATE_FORMAT, Hive.DATEINT_FORMAT.
const ( NormLowercase = "LOWERCASE" NormUppercase = "UPPERCASE" NormCaseSensitive = "CASE_SENSITIVE" NormCaseInsensitive = "CASE_INSENSITIVE" NormCaseInsensitiveUpper = "CASE_INSENSITIVE_UPPERCASE" )
Normalization strategies mirror sqlglot.dialects.dialect.NormalizationStrategy values.
const ( Loc_POST_CREATE = "POST_CREATE" Loc_POST_NAME = "POST_NAME" Loc_POST_SCHEMA = "POST_SCHEMA" Loc_POST_WITH = "POST_WITH" Loc_POST_ALIAS = "POST_ALIAS" Loc_POST_EXPRESSION = "POST_EXPRESSION" Loc_POST_INDEX = "POST_INDEX" Loc_UNSUPPORTED = "UNSUPPORTED" )
Properties.Location values.
const UNSUPPORTED_TEMPLATE = "Argument '%s' is not supported for expression '%s' when targeting %s."
UNSUPPORTED_TEMPLATE mirrors sqlglot.generator.UNSUPPORTED_TEMPLATE.
Variables ¶
var ( DataType_ARRAY_TYPES = newDTypeSet(DT_ARRAY, DT_LIST) DataType_FLOAT_TYPES = newDTypeSet(DT_DOUBLE, DT_FLOAT) DataType_INTEGER_TYPES = newDTypeSet(DT_BIGINT, DT_BIT, DT_INT, DT_INT128, DT_INT256, DT_MEDIUMINT, DT_SMALLINT, DT_TINYINT, DT_UBIGINT, DT_UINT, DT_UINT128, DT_UINT256, DT_UMEDIUMINT, DT_USMALLINT, DT_UTINYINT) DataType_NESTED_TYPES = newDTypeSet(DT_ARRAY, DT_FILE, DT_LIST, DT_MAP, DT_NESTED, DT_OBJECT, DT_STRUCT, DT_UNION) DataType_NUMERIC_TYPES = newDTypeSet(DT_BIGDECIMAL, DT_BIGINT, DT_BIT, DT_DECFLOAT, DT_DECIMAL, DT_DECIMAL128, DT_DECIMAL256, DT_DECIMAL32, DT_DECIMAL64, DT_DOUBLE, DT_FLOAT, DT_INT, DT_INT128, DT_INT256, DT_MEDIUMINT, DT_MONEY, DT_SMALLINT, DT_SMALLMONEY, DT_TINYINT, DT_UBIGINT, DT_UDECIMAL, DT_UDOUBLE, DT_UINT, DT_UINT128, DT_UINT256, DT_UMEDIUMINT, DT_USMALLINT, DT_UTINYINT) DataType_REAL_TYPES = newDTypeSet(DT_BIGDECIMAL, DT_DECFLOAT, DT_DECIMAL, DT_DECIMAL128, DT_DECIMAL256, DT_DECIMAL32, DT_DECIMAL64, DT_DOUBLE, DT_FLOAT, DT_MONEY, DT_SMALLMONEY, DT_UDECIMAL, DT_UDOUBLE) DataType_SIGNED_INTEGER_TYPES = newDTypeSet(DT_BIGINT, DT_INT, DT_INT128, DT_INT256, DT_MEDIUMINT, DT_SMALLINT, DT_TINYINT) DataType_STRUCT_TYPES = newDTypeSet(DT_FILE, DT_NESTED, DT_OBJECT, DT_STRUCT, DT_UNION) DataType_TEMPORAL_TYPES = newDTypeSet(DT_DATE, DT_DATE32, DT_DATETIME, DT_DATETIME2, DT_DATETIME64, DT_SMALLDATETIME, DT_TIME, DT_TIMESTAMP, DT_TIMESTAMPLTZ, DT_TIMESTAMPNTZ, DT_TIMESTAMPTZ, DT_TIMESTAMP_MS, DT_TIMESTAMP_NS, DT_TIMESTAMP_S, DT_TIMETZ) DataType_TEXT_TYPES = newDTypeSet(DT_CHAR, DT_NAME, DT_NCHAR, DT_NVARCHAR, DT_TEXT, DT_VARCHAR) DataType_UNSIGNED_INTEGER_TYPES = newDTypeSet(DT_UBIGINT, DT_UINT, DT_UINT128, DT_UINT256, DT_UMEDIUMINT, DT_USMALLINT, DT_UTINYINT) )
var ( TABLE_PARTS = []string{"this", "db", "catalog"} COLUMN_PARTS = []string{"this", "table", "db", "catalog"} )
var ALL_FUNCTIONS = []Kind{} /* 558 elements not displayed */
ALL_FUNCTIONS mirrors sqlglot.expressions.ALL_FUNCTIONS.
var ALL_JSON_PATH_PARTS = newKindSet(allJSONPathPartKinds...)
ALL_JSON_PATH_PARTS mirrors sqlglot.jsonpath.ALL_JSON_PATH_PARTS.
var BIGINT_EXTRACT_DATE_PARTS = newStrSet(
"EPOCH_SECOND",
"EPOCH_MILLISECOND",
"EPOCH_MICROSECOND",
"EPOCH_NANOSECOND",
"NANOSECOND",
)
BIGINT_EXTRACT_DATE_PARTS: EXTRACT/DATE_PART specifiers that return BIGINT instead of INT.
var DefaultOptimizerRules = []OptimizerRule{ RuleQualify, RulePushdownProjections, RuleNormalize, RuleUnnestSubqueries, RulePushdownPredicates, RuleOptimizeJoins, RuleEliminateSubqueries, RuleMergeSubqueries, RuleEliminateJoins, RuleEliminateCTEs, RuleQuoteIdentifiers, RuleAnnotateTypes, RuleCanonicalize, RuleSimplify, }
DefaultOptimizerRules mirrors sqlglot.optimizer.optimizer.RULES.
var FUNCTION_BY_NAME = map[string]Kind{}/* 624 elements not displayed */
FUNCTION_BY_NAME mirrors sqlglot.expressions.FUNCTION_BY_NAME.
var HIVE_NON_PADDED_TIME_FORMATS = []string{"'yyyy-M-d HH:mm:ss'", "'yyyy-M-d'"}
The default formats above, as rendered by the lenient rewrite (non-padded month/day).
var JSON_PATH_PART_TRANSFORMS = map[Kind]GenFunc{ KJSONPathFilter: func(g *Generator, e *Expr) string { return "?" + jsonPathFormat(e.Arg("this")) }, KJSONPathKey: func(g *Generator, e *Expr) string { return g.jsonpathkeySQL(e) }, KJSONPathRecursive: func(g *Generator, e *Expr) string { this := e.Arg("this") if !truthy(this) { return ".." } return ".." + jsonPathFormat(this) }, KJSONPathRoot: func(g *Generator, e *Expr) string { return "$" }, KJSONPathScript: func(g *Generator, e *Expr) string { return "(" + jsonPathFormat(e.Arg("this")) }, KJSONPathSelector: func(g *Generator, e *Expr) string { return "[" + g.jsonPathPart(e.Arg("this")) + "]" }, KJSONPathSlice: func(g *Generator, e *Expr) string { var parts []string for _, p := range []any{e.Arg("start"), e.Arg("end"), e.Arg("step")} { if p == nil { continue } if jsonPathIsFalse(p) { parts = append(parts, "") } else { parts = append(parts, g.jsonPathPart(p)) } } return strings.Join(parts, ":") }, KJSONPathSubscript: func(g *Generator, e *Expr) string { return g.jsonpathsubscriptSQL(e) }, KJSONPathUnion: func(g *Generator, e *Expr) string { items := jsonPathUnionItems(e) parts := make([]string, len(items)) for i, p := range items { parts[i] = g.jsonPathPart(p) } return "[" + strings.Join(parts, ",") + "]" }, KJSONPathWildcard: func(g *Generator, e *Expr) string { return "*" }, }
JSON_PATH_PART_TRANSFORMS mirrors sqlglot.jsonpath.JSON_PATH_PART_TRANSFORMS.
var Logger = func(msg string) {}
Logger receives the messages SQLGlot logs (parse errors under ErrorLevel.WARN). It discards them by default; embedders can replace it.
var NAME_TO_PROPERTY = map[string]Kind{ "ALGORITHM": KAlgorithmProperty, "AUTO_INCREMENT": KAutoIncrementProperty, "CHARACTER SET": KCharacterSetProperty, "CLUSTERED_BY": KClusteredByProperty, "COLLATE": KCollateProperty, "COMMENT": KSchemaCommentProperty, "CREDENTIALS": KCredentialsProperty, "DEFINER": KDefinerProperty, "DISTKEY": KDistKeyProperty, "DISTRIBUTED_BY": KDistributedByProperty, "DISTSTYLE": KDistStyleProperty, "ENGINE": KEngineProperty, "EXECUTE AS": KExecuteAsProperty, "FORMAT": KFileFormatProperty, "LANGUAGE": KLanguageProperty, "LOCATION": KLocationProperty, "LOCK": KLockProperty, "PARTITIONED_BY": KPartitionedByProperty, "RETURNS": KReturnsProperty, "ROW_FORMAT": KRowFormatProperty, "SORTKEY": KSortKeyProperty, "ENCODE": KEncodeProperty, "INCLUDE": KIncludeProperty, }
Properties.NAME_TO_PROPERTY / PROPERTY_TO_NAME.
var PROPERTY_TO_NAME = map[Kind]string{
KAlgorithmProperty: "ALGORITHM",
KAutoIncrementProperty: "AUTO_INCREMENT",
KCharacterSetProperty: "CHARACTER SET",
KClusteredByProperty: "CLUSTERED_BY",
KCollateProperty: "COLLATE",
KSchemaCommentProperty: "COMMENT",
KCredentialsProperty: "CREDENTIALS",
KDefinerProperty: "DEFINER",
KDistKeyProperty: "DISTKEY",
KDistributedByProperty: "DISTRIBUTED_BY",
KDistStyleProperty: "DISTSTYLE",
KEngineProperty: "ENGINE",
KExecuteAsProperty: "EXECUTE AS",
KFileFormatProperty: "FORMAT",
KLanguageProperty: "LANGUAGE",
KLocationProperty: "LOCATION",
KLockProperty: "LOCK",
KPartitionedByProperty: "PARTITIONED_BY",
KReturnsProperty: "RETURNS",
KRowFormatProperty: "ROW_FORMAT",
KSortKeyProperty: "SORTKEY",
KEncodeProperty: "ENCODE",
KIncludeProperty: "INCLUDE",
}
var PropertiesLocations = []string{"POST_CREATE", "POST_NAME", "POST_SCHEMA", "POST_WITH", "POST_ALIAS", "POST_EXPRESSION", "POST_INDEX", "UNSUPPORTED"}
Locations in definition order.
var QUERY_MODIFIERS = []string{"match", "laterals", "joins", "connect", "pivots", "prewhere", "where", "group", "having", "qualify", "windows", "distribute", "sort", "cluster", "order", "limit", "offset", "locks", "sample", "settings", "format", "options", "for_"}
QUERY_MODIFIERS mirrors exp.QUERY_MODIFIERS (ordered).
var SAFE_IDENTIFIER_RE = regexp.MustCompile(`^[_a-zA-Z][\p{L}\p{N}_]*\n?$`)
SAFE_IDENTIFIER_RE mirrors sqlglot.expressions.SAFE_IDENTIFIER_RE.
var STRICT_TIME_FORMATS = [][2]string{{"%mstrict", "%m"}, {"%dstrict", "%d"}}
STRICT_TIME_FORMATS mirrors dialect.STRICT_TIME_FORMATS (ordered). "Strict" dialects (e.g. modern Hive, Spark 3+) map their zero-padded MM/dd to these in TIME_MAPPING so they roundtrip, since a lax %m/%d renders non-padded there for parse expressions (see HiveGenerator.format_time).
var WEEK_START_DAY_TO_DOW = map[string]int{
"MONDAY": 1,
"TUESDAY": 2,
"WEDNESDAY": 3,
"THURSDAY": 4,
"FRIDAY": 5,
"SATURDAY": 6,
"SUNDAY": 7,
}
WEEK_START_DAY_TO_DOW mirrors dialect.WEEK_START_DAY_TO_DOW. Days of week to ISO 8601 day-of-week numbers ISO 8601 standard: Monday=1, Tuesday=2, Wednesday=3, Thursday=4, Friday=5, Saturday=6, Sunday=7.
Functions ¶
func DataTypeIsType ¶
DataTypeIsType mirrors exp.DataType.is_type(*dtypes, check_nullable=checkNullable).
func ExprString ¶
ExprString mirrors str(expression): SQL in the default dialect.
func FindAllInScope ¶
FindAllInScope mirrors sqlglot.optimizer.scope.find_all_in_scope.
func JoinCondition ¶
JoinCondition mirrors eliminate_joins.join_condition: extracts the join condition from a join expression. Returns (source key, join key, remaining predicate).
func LineageAll ¶
func LineageAll(expression *Expr, opts LineageOptions) (names []string, nodes map[string]*LineageNode, err error)
LineageAll mirrors lineage(None, sql, ...) returning an ordered map of output column -> node. The expression must already be qualified when opts.Scope is provided.
func NormalizationDistance ¶
NormalizationDistance is the exported form of normalizationDistance.
func Normalized ¶
Normalized is the exported form of normalizedCNF (optimizer.normalize.normalized).
func PivotOutputColumns ¶
PivotOutputColumns mirrors Pivot.output_columns.
func PushdownCTEAliasColumns ¶
func PushdownCTEAliasColumns(scope *Scope)
PushdownCTEAliasColumns mirrors pushdown_cte_alias_columns: pushes down the CTE alias columns into the projection.
This step is useful in Snowflake where the CTE alias columns can be referenced in the HAVING.
func QualifyOutputs ¶
QualifyOutputs mirrors qualify_outputs(expression, dialect) for an expression input: ensure all output columns are aliased.
func QualifyOutputsScope ¶
QualifyOutputsScope mirrors qualify_outputs(scope, dialect): ensure all output columns are aliased.
func ReplaceChildren ¶
ReplaceChildren mirrors exp.replace_children: fn returns nil, an *Expr or a []*Expr.
Types ¶
type AnnotateOptions ¶
type AnnotateOptions struct {
// Schema is used as-is when set (ensure_schema returns Schema instances unchanged, so
// Dialect is then ignored for the schema, exactly like Python).
Schema *MappingSchema
// SchemaMap is a raw nested mapping schema (Python dict), wrapped in a MappingSchema.
SchemaMap *SchemaMap
// Dialect is used when constructing the MappingSchema.
Dialect *Dialect
// ExpressionMetadata maps expression classes to annotators (default: the dialect's).
ExpressionMetadata ExprMetadataType
// CoercesTo maps a type to the set of types it can be coerced into (default: the dialect's).
CoercesTo map[DType]DTypeSet
// OverwriteTypes re-annotates already annotated nodes. nil means True (Python's default).
OverwriteTypes *bool
}
AnnotateOptions mirrors the keyword arguments of annotate_types.
type DType ¶
type DType uint16
DType mirrors sqlglot.expressions.DataType.Type.
const ( DT_NONE DType = 0 DT_ARRAY DType = 1 DT_AGGREGATEFUNCTION DType = 2 DT_SIMPLEAGGREGATEFUNCTION DType = 3 DT_BIGDECIMAL DType = 4 DT_BIGINT DType = 5 DT_BIGNUM DType = 6 DT_BIGSERIAL DType = 7 DT_BINARY DType = 8 DT_BIT DType = 9 DT_BLOB DType = 10 DT_BOOLEAN DType = 11 DT_BPCHAR DType = 12 DT_CHAR DType = 13 DT_CHARACTER_SET DType = 14 DT_DATE DType = 15 DT_DATE32 DType = 16 DT_DATEMULTIRANGE DType = 17 DT_DATERANGE DType = 18 DT_DATETIME DType = 19 DT_DATETIME2 DType = 20 DT_DATETIME64 DType = 21 DT_DECIMAL DType = 22 DT_DECIMAL32 DType = 23 DT_DECIMAL64 DType = 24 DT_DECIMAL128 DType = 25 DT_DECIMAL256 DType = 26 DT_DECFLOAT DType = 27 DT_DOUBLE DType = 28 DT_DYNAMIC DType = 29 DT_ENUM DType = 30 DT_ENUM8 DType = 31 DT_ENUM16 DType = 32 DT_FILE DType = 33 DT_FIXEDSTRING DType = 34 DT_FLOAT DType = 35 DT_GEOGRAPHY DType = 36 DT_GEOGRAPHYPOINT DType = 37 DT_GEOMETRY DType = 38 DT_POINT DType = 39 DT_RING DType = 40 DT_LINESTRING DType = 41 DT_MULTILINESTRING DType = 42 DT_POLYGON DType = 43 DT_MULTIPOLYGON DType = 44 DT_HLLSKETCH DType = 45 DT_HSTORE DType = 46 DT_IMAGE DType = 47 DT_INET DType = 48 DT_INT DType = 49 DT_INT128 DType = 50 DT_INT256 DType = 51 DT_INT4MULTIRANGE DType = 52 DT_INT4RANGE DType = 53 DT_INT8MULTIRANGE DType = 54 DT_INT8RANGE DType = 55 DT_INTERVAL DType = 56 DT_IPADDRESS DType = 57 DT_IPPREFIX DType = 58 DT_IPV4 DType = 59 DT_IPV6 DType = 60 DT_JSON DType = 61 DT_JSONB DType = 62 DT_LIST DType = 63 DT_LONGBLOB DType = 64 DT_LONGTEXT DType = 65 DT_LOWCARDINALITY DType = 66 DT_MAP DType = 67 DT_MEDIUMBLOB DType = 68 DT_MEDIUMINT DType = 69 DT_MEDIUMTEXT DType = 70 DT_MONEY DType = 71 DT_NAME DType = 72 DT_NCHAR DType = 73 DT_NESTED DType = 74 DT_NOTHING DType = 75 DT_NULL DType = 76 DT_NUMMULTIRANGE DType = 77 DT_NUMRANGE DType = 78 DT_NVARCHAR DType = 79 DT_OBJECT DType = 80 DT_RANGE DType = 81 DT_ROWVERSION DType = 82 DT_SERIAL DType = 83 DT_SET DType = 84 DT_SMALLDATETIME DType = 85 DT_SMALLINT DType = 86 DT_SMALLMONEY DType = 87 DT_SMALLSERIAL DType = 88 DT_STRUCT DType = 89 DT_SUPER DType = 90 DT_TEXT DType = 91 DT_TINYBLOB DType = 92 DT_TINYTEXT DType = 93 DT_TIME DType = 94 DT_TIMETZ DType = 95 DT_TIME_NS DType = 96 DT_TIMESTAMP DType = 97 DT_TIMESTAMPNTZ DType = 98 DT_TIMESTAMPLTZ DType = 99 DT_TIMESTAMPTZ DType = 100 DT_TIMESTAMP_S DType = 101 DT_TIMESTAMP_MS DType = 102 DT_TIMESTAMP_NS DType = 103 DT_TINYINT DType = 104 DT_TSMULTIRANGE DType = 105 DT_TSRANGE DType = 106 DT_TSTZMULTIRANGE DType = 107 DT_TSTZRANGE DType = 108 DT_UBIGINT DType = 109 DT_UINT DType = 110 DT_UINT128 DType = 111 DT_UINT256 DType = 112 DT_UMEDIUMINT DType = 113 DT_UDECIMAL DType = 114 DT_UDOUBLE DType = 115 DT_UNION DType = 116 DT_UNKNOWN DType = 117 DT_USERDEFINED DType = 118 DT_USMALLINT DType = 119 DT_UTINYINT DType = 120 DT_UUID DType = 121 DT_VARBINARY DType = 122 DT_VARCHAR DType = 123 DT_VARIANT DType = 124 DT_VECTOR DType = 125 DT_XML DType = 126 DT_YEAR DType = 127 DT_TDIGEST DType = 128 )
type DTypeSet ¶
type DTypeSet struct {
// contains filtered or unexported fields
}
DTypeSet is a bitset of data types.
type Dialect ¶
type Dialect struct {
// Name is the registry key ("" for the base sqlglot dialect).
Name string
// ClassName is the sqlglot class name, e.g. "BigQuery".
ClassName string
S *DialectSettings
T *TokenizerSettings
P *ParserSettings
G *GeneratorSettings
NormalizationStrategy string
Version [3]int
Settings map[string]any
// contains filtered or unexported fields
}
Dialect mirrors a sqlglot Dialect instance.
func GetDialect ¶
GetDialect mirrors Dialect.get_or_raise for string inputs. Settings may follow the name, e.g. "mysql, normalization_strategy = case_sensitive".
func MustDialect ¶
MustDialect returns the dialect or panics.
func (*Dialect) CanQuote ¶
CanQuote mirrors Dialect.can_quote. identify is "true", "false", "safe" or "unsafe".
func (*Dialect) CaseSensitive ¶
CaseSensitive mirrors Dialect.case_sensitive.
func (*Dialect) Generate ¶
func (d *Dialect) Generate(e *Expr, opts *GenerateOptions) (string, error)
Generate renders an expression with this dialect (mirrors Dialect.generate).
func (*Dialect) GenerateOwned ¶
func (d *Dialect) GenerateOwned(e *Expr, opts *GenerateOptions) (string, error)
GenerateOwned is Generate for an expression the caller does not use afterwards.
func (*Dialect) NewGenerator ¶
func (d *Dialect) NewGenerator(opts *GenerateOptions) *Generator
NewGenerator creates a generator for the dialect.
func (*Dialect) NewParser ¶
func (d *Dialect) NewParser(opts *ParseOptions) *Parser
NewParser creates a parser for the dialect.
func (*Dialect) NormalizeIdentifier ¶
NormalizeIdentifier mirrors Dialect.normalize_identifier.
func (*Dialect) Parse ¶
func (d *Dialect) Parse(sql string, opts *ParseOptions) ([]*Expr, error)
Parse mirrors Dialect.parse(sql).
func (*Dialect) ParseOne ¶
func (d *Dialect) ParseOne(sql string, opts *ParseOptions) (*Expr, error)
ParseOne mirrors sqlglot.parse_one(sql, read=dialect).
func (*Dialect) ParseOneInto ¶
ParseOneInto mirrors sqlglot.parse_one(sql, read=dialect, into=kind).
func (*Dialect) QuoteIdentifier ¶
QuoteIdentifier mirrors Dialect.quote_identifier.
func (*Dialect) TokenizeScript ¶
TokenizeScript tokenizes like the dialect's tokenizer but with COMMANDS emptied, so that procedural blocks stay visible (mirrors `type("ScriptTokenizer", (tokenizer_class,), {"COMMANDS": set()})`). Subclassing re-runs Tokenizer.__init_subclass__, which resets BYTE_STRING_ESCAPES to STRING_ESCAPES because the subclass does not define its own.
type DialectSettings ¶
type DialectSettings struct {
ALIAS_POST_TABLESAMPLE bool
ALIAS_POST_VERSION bool
ALTER_TABLE_ADD_REQUIRED_FOR_EACH_COLUMN bool
ALTER_TABLE_SUPPORTS_CASCADE bool
ANNOTATE_ALL_SCOPES bool
ARRAY_AGG_INCLUDES_NULLS Tri
ARRAY_FUNCS_PROPAGATES_NULLS bool
BIT_END string
BIT_START string
BYTE_END string
BYTE_START string
BYTE_STRINGS_SUPPORT_ESCAPED_SEQUENCES bool
BYTE_STRING_IS_BYTES_TYPE bool
COALESCE_COMPARISON_NON_STANDARD bool
CONCAT_COALESCE bool
CONCAT_WS_COALESCE bool
CONVERT_FORMAT_MAPPING map[string]string
COPY_PARAMS_ARE_CSV bool
CREATABLE_KIND_MAPPING map[string]string
DATEINT_FORMAT string
DATE_FORMAT string
DATE_PART_MAPPING map[string]string
DEFAULT_FUNCTIONS_COLUMN_NAMES map[Kind]string
DEFAULT_NULL_TYPE DType
DISABLES_ALIAS_REF_EXPANSION bool
DPIPE_IS_STRING_CONCAT bool
ESCAPED_SEQUENCES map[string]string
EXCLUDES_PSEUDOCOLUMNS_FROM_STAR bool
EXPAND_ONLY_GROUP_ALIAS_REF bool
FORCE_EARLY_ALIAS_REF_EXPANSION bool
FORMAT_MAPPING map[string]string
FORMAT_TIME_MAPPING map[string]string
HAS_DISTINCT_ARRAY_CONSTRUCTORS bool
HEX_END string
HEX_LOWERCASE bool
HEX_START string
HEX_STRING_IS_INTEGER_TYPE bool
IDENTIFIERS_CAN_START_WITH_DIGIT bool
IDENTIFIER_END string
IDENTIFIER_START string
INDEX_OFFSET int
INITCAP_DEFAULT_DELIMITER_CHARS string
INITCAP_SUPPORTS_CUSTOM_DELIMITERS bool
INVERSE_CREATABLE_KIND_MAPPING map[string]string
INVERSE_FORMAT_MAPPING map[string]string
INVERSE_TIME_MAPPING map[string]string
INVERSE_VECTOR_TYPE_ALIASES map[string]string
JSON_EXTRACT_SCALAR_SCALAR_ONLY bool
JSON_PATH_SINGLE_DOT_IS_WILDCARD bool
LEAST_GREATEST_IGNORES_NULLS bool
LOCKING_READS_SUPPORTED bool
LOG_BASE_FIRST Tri
NORMALIZATION_STRATEGY string
NORMALIZE_FUNCTIONS string
NULL_ORDERING string
NUMBERS_CAN_BE_UNDERSCORE_SEPARATED bool
ON_CONDITION_EMPTY_BEFORE_ERROR bool
PREFER_CTE_ALIAS_COLUMN bool
PRESERVE_ORIGINAL_NAMES bool
PRIORITIZE_NON_LITERAL_TYPES bool
PROJECTION_ALIASES_SHADOW_SOURCE_NAMES bool
PROMOTE_TO_INFERRED_DATETIME_TYPE bool
PSEUDOCOLUMNS StrSet
QUERY_RESULTS_ARE_STRUCTS bool
QUOTE_END string
QUOTE_START string
REGEXP_EXTRACT_DEFAULT_GROUP int
REGEXP_EXTRACT_POSITION_OVERFLOW_RETURNS_NULL bool
REQUIRES_PARENTHESIZED_STRUCT_ACCESS bool
SAFE_DIVISION bool
SAFE_TO_ELIMINATE_DOUBLE_NEGATION bool
SET_OP_DISTINCT_BY_DEFAULT map[Kind]Tri
STRICT_JSON_PATH_SYNTAX bool
STRICT_STRING_CONCAT bool
STRINGS_SUPPORT_ESCAPED_SEQUENCES bool
SUPPORTED_SETTINGS StrSet
SUPPORTS_ALIAS_REFS_IN_JOIN_CONDITIONS bool
SUPPORTS_COLUMN_JOIN_MARKS bool
SUPPORTS_FIXED_SIZE_ARRAYS bool
SUPPORTS_LIMIT_ALL bool
SUPPORTS_NULL_TYPE bool
SUPPORTS_ORDER_BY_ALL bool
SUPPORTS_STRUCT_STAR_EXPANSION bool
SUPPORTS_USER_DEFINED_TYPES bool
SUPPORTS_VALUES_DEFAULT bool
TABLESAMPLE_SIZE_IS_PERCENT bool
TABLES_REFERENCEABLE_AS_COLUMNS bool
TIME_FORMAT string
TIME_MAPPING map[string]string
TRY_CAST_REQUIRES_STRING Tri
TYPED_DIVISION bool
UNESCAPED_SEQUENCES map[string]string
UNICODE_END string
UNICODE_START string
UNNEST_COLUMN_ONLY bool
UUID_IS_STRING_TYPE bool
VALID_INTERVAL_UNITS StrSet
WEEK_OFFSET int
}
type ErrorLevel ¶
type ErrorLevel int
ErrorLevel mirrors sqlglot.errors.ErrorLevel.
const ( ErrorLevelImmediate ErrorLevel = iota ErrorLevelIgnore ErrorLevelWarn ErrorLevelRaise )
type Expr ¶
type Expr struct {
// contains filtered or unexported fields
}
Expr is a node of a sqlglot syntax tree. It mirrors sqlglot.expressions.Expression: a class (Kind) plus an ordered mapping of argument keys to values.
Argument values are one of: nil, *Expr, []*Expr, string, bool, int, DType.
func AliasExpr ¶
AliasExpr mirrors exp.alias_(expression, alias, table=False, quoted=quoted, copy=copy).
func AliasTableExpr ¶
AliasTableExpr mirrors exp.alias_(expression, alias, table=True or columns, ...). columns holds the optional column names (string or Identifier).
func AliasWithQuote ¶
AliasWithQuote mirrors exp.alias_(e, name, quoted=quoted).
func AndExpr ¶
AndExpr mirrors exp.and_(*expressions) (copy=True, wrap=True). nil inputs are skipped.
func AndExprOpts ¶
AndExprOpts mirrors exp.and_(*expressions, copy=copy, wrap=wrap).
func AnnotateTypes ¶
func AnnotateTypes(expression *Expr, o AnnotateOptions) *Expr
AnnotateTypes mirrors annotate_types(expression, schema, expression_metadata, coerces_to, dialect, overwrite_types): infers the types of an expression, annotating its AST accordingly.
func Canonicalize ¶
Canonicalize mirrors optimizer.canonicalize.canonicalize: converts a sql expression into a standard form. This relies on annotate_types because many of the conversions rely on type inference. d == nil means the default dialect.
func CastExpr ¶
CastExpr mirrors exp.cast(expression, to, copy=copy, dialect=d). `to` is a DType, a type string or a DataType expression; d == nil uses the default dialect.
func CastToType ¶
CastToType mirrors exp.cast(e, "<type>") with the default dialect.
func ColumnExpr ¶
ColumnExpr mirrors exp.column(col, table, db, catalog, fields=fields, quoted=quoted, copy=copy). col is a string, Identifier or Star; table/db/catalog/fields entries are nil, strings or Identifiers.
func ConditionExpr ¶
ConditionExpr mirrors exp.condition for an expression input.
func DataTypeBuild ¶
DataTypeBuild mirrors exp.DataType.build(dtype, dialect=d, udt=udt, copy=copy) for DType, string and expression inputs.
func DataTypeFromStr ¶
DataTypeFromStr mirrors exp.DataType.from_str(dtype, dialect, udt).
func EliminateCTEs ¶
EliminateCTEs mirrors optimizer.eliminate_ctes.eliminate_ctes: removes unused CTEs from an expression.
Example: "WITH y AS (SELECT a FROM x) SELECT a FROM z" -> "SELECT a FROM z".
func EliminateJoins ¶
EliminateJoins mirrors optimizer.eliminate_joins.eliminate_joins: removes unused joins from an expression.
This only removes joins when we know that the join condition doesn't produce duplicate rows.
Example: "SELECT x.a FROM x LEFT JOIN (SELECT DISTINCT y.b FROM y) AS y ON x.b = y.b" -> "SELECT x.a FROM x".
func EliminateSubqueries ¶
EliminateSubqueries mirrors optimizer.eliminate_subqueries.eliminate_subqueries: rewrites derived tables as CTES, deduplicating if possible.
Example: "SELECT a FROM (SELECT * FROM x) AS y" -> "WITH y AS (SELECT * FROM x) SELECT a FROM y AS y".
func ExceptExpr ¶
ExceptExpr mirrors exp.except_(*expressions, distinct=distinct, copy=copy).
func FindInScope ¶
FindInScope mirrors sqlglot.optimizer.scope.find_in_scope.
func FromArgList ¶
FromArgList mirrors Func.from_arg_list: positional args are mapped onto the class arg_types in order. If the class has is_var_len_args, the last arg type receives the remaining args as a list (possibly empty). Extra args of non var-len functions are dropped (zip semantics).
func IntersectExpr ¶
IntersectExpr mirrors exp.intersect(*expressions, distinct=distinct, copy=copy).
func IsolateTableSelects ¶
func IsolateTableSelects(expression *Expr, schema *MappingSchema, d *Dialect) *Expr
IsolateTableSelects mirrors isolate_table_selects(expression, schema, dialect). A nil schema is replaced by an empty MappingSchema for the dialect (ensure_schema).
func LiteralNumber ¶
LiteralNumber mirrors exp.Literal.number for an already-formatted number string.
func MaybeParse ¶
MaybeParse mirrors exp.maybe_parse for string inputs: sqlglot.parse_one(prefix + " " + sql, read=d, into=into). into == KNone parses a statement; d == nil uses the default dialect. Parse failures panic (ParseError via parsePanic), like the Python exception.
func MergeDerivedTables ¶
MergeDerivedTables mirrors merge_subqueries.merge_derived_tables.
func MergeSubqueries ¶
MergeSubqueries mirrors sqlglot.optimizer.merge_subqueries.merge_subqueries.
Rewrite sqlglot AST to merge derived tables into the outer query. This also merges CTEs if they are selected from only once.
If leaveTablesIsolated is true, this will not merge inner queries into outer queries if it would result in multiple table selects in a single query.
func New ¶
New creates an expression of the given kind from alternating key/value pairs. Keys with nil values are kept (like Python keyword arguments set to None).
func NewCTE ¶
NewCTE mirrors exp.CTE(this=body, alias=exp.TableAlias(this=exp.to_identifier(name))).
func NormalizeCNF ¶
NormalizeCNF mirrors optimizer.normalize.normalize: rewrites a sqlglot AST into conjunctive normal form (or disjunctive normal form when dnf is true). Python defaults: dnf=False, max_distance=128.
Example: "(x AND y) OR z" -> "(x OR z) AND (y OR z)".
func NormalizeIdentifiers ¶
NormalizeIdentifiers mirrors normalize_identifiers(expression, dialect) (store_original_column_identifiers=False).
Identifiers are converted to lower or upper case depending on the dialect, respecting case-sensitivity. A node annotated with `/* sqlglot.meta case_sensitive */` (and its subtree) is left untouched. A nil dialect means the default sqlglot dialect.
func NormalizeIdentifiersFull ¶
NormalizeIdentifiersFull mirrors normalize_identifiers(expression, dialect, store_original_column_identifiers).
func NormalizeIdentifiersStr ¶
NormalizeIdentifiersStr mirrors normalize_identifiers(<str>, dialect): the string is parsed into an Identifier (exp.parse_identifier) and normalized.
func Optimize ¶
func Optimize(e *Expr, schema *MappingSchema, d *Dialect, rules []OptimizerRule) *Expr
Optimize mirrors sqlglot.optimizer.optimize(expression, schema, dialect=dialect, rules=rules). The expression is copied first. nil rules means DefaultOptimizerRules (Python's RULES). Errors are raised as panics, like the Python exceptions.
func OptimizeJoins ¶
OptimizeJoins mirrors optimizer.optimize_joins.optimize_joins: removes cross joins if possible and reorders joins based on predicate dependencies.
Example: "SELECT * FROM x CROSS JOIN y JOIN z ON x.a = z.a AND y.a = z.a" -> "SELECT * FROM x JOIN z ON x.a = z.a AND TRUE JOIN y ON y.a = z.a".
func OptimizeSafe ¶
func OptimizeSafe(e *Expr, schema *SchemaMap, d *Dialect, rules []OptimizerRule) (out *Expr, err error)
OptimizeSafe mirrors `optimize(expression, schema=schema_dict, dialect=d, rules=rules)` with errors returned instead of raised. schema is the nested schema dict (ensure_schema wraps it in a MappingSchema for the dialect); nil rules means the default RULES.
func OptimizeWith ¶
func OptimizeWith(e *Expr, ctx *OptimizeContext, rules []OptimizerRule) *Expr
OptimizeWith mirrors sqlglot.optimizer.optimize with every argument (db, catalog, sql, **kwargs) in ctx. nil rules means DefaultOptimizerRules.
func OrExprOpts ¶
OrExprOpts mirrors exp.or_(*expressions, copy=copy, wrap=wrap).
func PushdownPredicates ¶
PushdownPredicates mirrors optimizer.pushdown_predicates.pushdown_predicates: rewrites the AST to pushdown predicates in FROMS and JOINS. d == nil means the default dialect.
Example: "SELECT y.a AS a FROM (SELECT x.a AS a FROM x AS x) AS y WHERE y.a = 1" -> "SELECT y.a AS a FROM (SELECT x.a AS a FROM x AS x WHERE x.a = 1) AS y WHERE TRUE".
func PushdownProjections ¶
func PushdownProjections(expression *Expr, schema *MappingSchema, removeUnusedSelections bool, d *Dialect) *Expr
PushdownProjections mirrors optimizer.pushdown_projections.pushdown_projections: rewrites the AST to remove unused columns projections. schema == nil means an empty schema, d == nil the default dialect. Python defaults: remove_unused_selections=True.
Example: "SELECT y.a AS a FROM (SELECT x.a AS a, x.b AS b FROM x) AS y" -> "SELECT y.a AS a FROM (SELECT x.a AS a FROM x) AS y".
func Qualify ¶
func Qualify(expression *Expr, o QualifyOptions) *Expr
Qualify mirrors sqlglot.optimizer.qualify.qualify: rewrite the AST to have normalized and qualified tables and columns. This step is necessary for all further SQLGlot optimizations.
Errors are raised as panics (*OptimizeError, *SchemaError, *ValueError ...), like the Python exceptions.
func QualifyColumns ¶
func QualifyColumns(expression *Expr, schema *MappingSchema, expandAliasRefs, expandStars bool, inferSchema Tri, allowPartialQualification bool, d *Dialect) *Expr
QualifyColumns mirrors qualify_columns(expression, schema, expand_alias_refs, expand_stars, infer_schema, allow_partial_qualification, dialect).
It rewrites the AST to have fully qualified columns. inferSchema TriNone means "infer the schema iff it is empty". A nil schema is replaced by an empty MappingSchema for d (ensure_schema); d is otherwise unused, like in Python (the schema dialect drives the qualification).
Notes:
- Currently only handles a single PIVOT or UNPIVOT operator
func QualifyDerivedTableOutputsTSQL ¶
QualifyDerivedTableOutputsTSQL mirrors generators/tsql.py qualify_derived_table_outputs: ensures all (unnamed) output columns are aliased for CTEs and Subqueries.
func QualifyTables ¶
func QualifyTables(expression *Expr, db, catalog string, onQualify func(table *Expr), d *Dialect, canonicalizeTableAliases bool) *Expr
QualifyTables mirrors qualify_tables(expression, db, catalog, on_qualify, dialect, canonicalize_table_aliases).
It rewrites the AST to have fully qualified tables. Join constructs such as (t1 JOIN t2) AS t are expanded into (SELECT * FROM t1 AS t1, t2 AS t2) AS t. Empty db / catalog mean None; onQualify may be nil.
func QueryLimitBuild ¶
QueryLimitBuild mirrors `query.limit(n, dialect=d)` (copy=True) for an integer limit.
func QueryLimitBuildOwned ¶
QueryLimitBuildOwned is QueryLimitBuild for a query the caller does not use afterwards.
func QueryWithBuild ¶
QueryWithBuild mirrors `query.with_(name, as_=sql, dialect=d, copy=False)`.
func QuoteIdentifiers ¶
QuoteIdentifiers mirrors quote_identifiers(expression, dialect, identify): makes sure all identifiers that need to be quoted are quoted.
func ReorderJoins ¶
ReorderJoins mirrors optimize_joins.reorder_joins: reorders joins by topological sort order based on predicate references.
func ReplaceTree ¶
ReplaceTree mirrors exp.replace_tree (reverse DFS, leaves first; new nodes are traversed too).
func SelectExpr ¶
SelectExpr mirrors exp.select(*expressions).
func SelectReplaceProjections ¶
SelectReplaceProjections mirrors select_expr.select(projection, append=False) (copy=True): a copy of sel whose projections are replaced by the given projection. Like Python, the projection is not copied, so it is re-parented under the returned select.
func Simplify ¶
func Simplify(e *Expr, o SimplifyOptions) *Expr
Simplify mirrors sqlglot.optimizer.simplify.simplify: rewrites a sqlglot AST to simplify expressions, e.g. "TRUE AND TRUE" -> "TRUE". The expression is mutated in place.
Python exceptions that simplify lets escape (e.g. decimal.DivisionByZero for `1.0 / 0`, OverflowError for out-of-range date arithmetic) are raised as panics.
func SimplifyParens ¶
SimplifyParens mirrors sqlglot.optimizer.simplify.simplify_parens.
func SubqueryExpr ¶
SubqueryExpr mirrors exp.subquery(expression, alias, copy=copy).
func ToIdentifier ¶
ToIdentifier mirrors exp.to_identifier for strings. quoted: nil means auto.
func ToIdentifierAny ¶
ToIdentifierAny mirrors exp.to_identifier(name, quoted, copy) for nil, string and Identifier inputs.
func UnnestSubqueries ¶
UnnestSubqueries mirrors sqlglot.optimizer.unnest_subqueries.unnest_subqueries.
Rewrite sqlglot AST to convert some predicates with subqueries into joins.
Convert scalar subqueries into cross joins. Convert correlated or vectorized subqueries into a group by so it is not a many to many left join.
func ValidateQualifyColumns ¶
ValidateQualifyColumns mirrors validate_qualify_columns(expression, sql): it raises an OptimizeError if any columns aren't qualified. sql "" means None.
func VarChecked ¶
VarChecked mirrors exp.var(name) for a string, including its empty-name ValueError.
func WithValidateArgs ¶
WithValidateArgs records the post-mutation argument list of a function builder on e and returns e.
func XorExprOpts ¶
XorExprOpts mirrors exp.xor(*expressions, copy=copy, wrap=wrap).
func (*Expr) AddComments ¶
AddComments mirrors Expression.add_comments.
func (*Expr) AliasColumnNames ¶
AliasColumnNames mirrors the `alias_column_names` property.
func (*Expr) AliasOrName ¶
AliasOrName mirrors the `alias_or_name` property.
func (*Expr) ArgB ¶
ArgB returns the truthiness of an argument, like bool(expression.args.get(key)).
func (*Expr) ArgE ¶
ArgE returns the argument as an expression (nil if absent or not an expression).
func (*Expr) BFS ¶
BFS mirrors Expression.bfs. Children are collected after the consumer has seen their parent, like Python's lazy iter_expressions.
func (*Expr) CatalogName ¶
CatalogName mirrors Column.catalog / Table.catalog.
func (*Expr) Comments ¶
Comments returns the attached comments (nil when there are none, like Python's None).
func (*Expr) ErrorMessages ¶
ErrorMessages mirrors Expression.error_messages.
func (*Expr) Expression ¶
Expression returns args["expression"] as an expression.
func (*Expr) Expressions ¶
Expressions returns args["expressions"] (or an empty list).
func (*Expr) FindAllDFS ¶
FindAllDFS mirrors Expression.find_all(bfs=False).
func (*Expr) FindAllList ¶
FindAllList collects FindAll into a slice.
func (*Expr) FindAncestor ¶
FindAncestor mirrors Expression.find_ancestor.
func (*Expr) IsSemiOrAntiJoin ¶
IsSemiOrAntiJoin mirrors Join.is_semi_or_anti_join.
func (*Expr) IsTypeOf ¶
IsTypeOf mirrors Expr.is_type(*dtypes), dispatching like Python does on the receiver class:
- DataType (and subclasses): DataType.is_type, i.e. structural comparison of the node itself;
- Cast (and subclasses): Cast.is_type, i.e. self.to.is_type(*dtypes);
- any other expression: Expression.is_type, which checks the annotated `_type` slot (False when the expression has not been annotated).
Each dtype may be a DType, a type string (parsed with the default dialect, udt=True) or a DataType expression, like Python's DATA_TYPE union.
func (*Expr) IterExpressions ¶
IterExpressions yields child expressions in argument order.
func (*Expr) MetaGet ¶
MetaGet reads a metadata value without allocating. Explicit map entries take precedence over the inline position fields.
func (*Expr) NamedSelects ¶
NamedSelects mirrors the `named_selects` property.
func (*Expr) OutputName ¶
OutputName mirrors the `output_name` property.
func (*Expr) Own ¶
Own stands in for e.Copy() when the caller hands e over and never uses it (or any of its nodes) again. A copy of a parentless root whose nodes are each held exactly once, with no types, string-list arguments or non-scalar meta, is indistinguishable from the original, so such trees are returned as they are (with comment lists un-shared, as the copy would have them); anything else is copied.
func (*Expr) ParentSelect ¶
ParentSelect mirrors Expression.parent_select.
func (*Expr) PopComments ¶
PopComments mirrors Expression.pop_comments.
func (*Expr) QueryExcept ¶
QueryExcept mirrors Query.except_(*expressions, distinct=distinct, copy=copy).
func (*Expr) QueryIntersect ¶
QueryIntersect mirrors Query.intersect(*expressions, distinct=distinct, copy=copy).
func (*Expr) QueryLimit ¶
QueryLimit mirrors Query.limit(expression, copy=copy).
func (*Expr) QueryOffset ¶
QueryOffset mirrors Query.offset(expression, copy=copy).
func (*Expr) QueryOrderBy ¶
QueryOrderBy mirrors Query.order_by(*expressions, append=appendMode, copy=copy).
func (*Expr) QuerySelect ¶
QuerySelect mirrors Select.select / SetOperation.select / Subquery.select.
func (*Expr) QuerySubquery ¶
QuerySubquery mirrors Query.subquery(alias, copy=copy). alias: nil, string or *Expr.
func (*Expr) QueryUnion ¶
QueryUnion mirrors Query.union(*expressions, distinct=distinct, copy=copy).
func (*Expr) QueryWhere ¶
QueryWhere mirrors Query.where(*expressions, append=appendMode, copy=copy).
func (*Expr) QueryWith ¶
func (e *Expr) QueryWith(alias, as *Expr, recursive, materialized any, appendMode bool, copy bool, scalar any) *Expr
QueryWith mirrors Query.with_(alias, as_, recursive, materialized, append, copy=copy, scalar). recursive, materialized and scalar take nil, true or false.
func (*Expr) ReplaceWithList ¶
ReplaceWithList mirrors Expression.replace(list) for list arguments.
func (*Expr) SQL ¶
func (e *Expr) SQL(dialect string, opts *GenerateOptions) (string, error)
SQL renders the expression using the given dialect (mirrors Expression.sql(dialect)).
func (*Expr) SameParent ¶
SameParent mirrors Expression.same_parent.
func (*Expr) SelectClusterBy ¶
SelectClusterBy mirrors Select.cluster_by(*expressions, append=appendMode, copy=copy).
func (*Expr) SelectDistinct ¶
SelectDistinct mirrors Select.distinct(*ons, distinct=distinct, copy=copy).
func (*Expr) SelectFrom ¶
SelectFrom mirrors Select.from_(expression, copy=copy).
func (*Expr) SelectGroupBy ¶
SelectGroupBy mirrors Select.group_by(*expressions, append=appendMode, copy=copy).
func (*Expr) SelectHaving ¶
SelectHaving mirrors Select.having(*expressions, append=appendMode, copy=copy).
func (*Expr) SelectHint ¶
SelectHint mirrors Select.hint(*hints, copy=copy).
func (*Expr) SelectJoin ¶
func (e *Expr) SelectJoin(expression *Expr, on []*Expr, using []*Expr, appendMode bool, joinType string, joinAlias any, copy bool) *Expr
SelectJoin mirrors Select.join(expression, on=on, using=using, append=appendMode, join_type=joinType, join_alias=joinAlias, copy=copy). joinType "" means None (when set it is parsed with the default dialect, like sqlglot does); joinAlias is nil, a string or an Identifier.
func (*Expr) SelectLateral ¶
SelectLateral mirrors Select.lateral(*expressions, append=appendMode, copy=copy).
func (*Expr) SelectLock ¶
SelectLock mirrors Select.lock(update=update, copy=copy).
func (*Expr) SelectQualify ¶
SelectQualify mirrors Select.qualify(*expressions, append=appendMode, copy=copy).
func (*Expr) SelectSortBy ¶
SelectSortBy mirrors Select.sort_by(*expressions, append=appendMode, copy=copy).
func (*Expr) SelectWindow ¶
SelectWindow mirrors Select.window(*expressions, append=appendMode, copy=copy).
func (*Expr) SetComments ¶
SetComments replaces the attached comments. An empty, non-nil list is kept as a flag.
func (*Expr) SetTypeAny ¶
SetTypeAny mirrors the Expression.type setter: any truthy value whose class is not exactly DataType (a DType, a type string, a DataType subclass, ...) is converted with DataType.build.
func (*Expr) TableAliasColumns ¶
TableAliasColumns mirrors TableAlias.columns.
func (*Expr) Unnest ¶
Unnest mirrors the polymorphic Expression.unnest: Subquery.unnest (first non-subquery) for subqueries, otherwise strip enclosing Paren nodes.
func (*Expr) UnnestOperands ¶
UnnestOperands mirrors Expression.unnest_operands.
func (*Expr) UnnestSubquery ¶
UnnestSubquery mirrors Subquery.unnest (first non-subquery).
func (*Expr) UnnestSubqueryOrParen ¶
UnnestSubqueryOrParen mirrors Expr.unnest() as dispatched for the receiver's class: Subquery.unnest strips nested subqueries, the default strips parentheses.
type ExprMetadata ¶
type ExprMetadata struct {
Annotator func(a *TypeAnnotator, e *Expr)
// Returns is a DType or a DataType *Expr (shared, like the Python object).
Returns any
// contains filtered or unexported fields
}
ExprMetadata mirrors an entry of an EXPRESSION_METADATA dict: either an annotator callback ({"annotator": fn}) or a static return type ({"returns": DType | DataType}).
type ExprMetadataType ¶
type ExprMetadataType map[Kind]*ExprMetadata
ExprMetadataType mirrors sqlglot.typing.ExprMetadataType: metadata keyed by exact expression class.
type FuncBuilder ¶
Callable table types mirroring the dict[...]->callable tables of sqlglot.parser.Parser.
type GenerateOptions ¶
type GenerateOptions struct {
Pretty bool
// Identify: "" or "false" (default), "true", "safe", "unsafe".
Identify string
Normalize bool
Pad int
Indent int
NormalizeFunctions *string
UnsupportedLevel *ErrorLevel
MaxUnsupported int
LeadingComma bool
MaxTextWidth int
NoComments bool
}
GenerateOptions mirrors the generator keyword options.
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator mirrors sqlglot.generator.Generator.
type GeneratorData ¶
type GeneratorData struct {
ALTER_SET_TYPE string
ALTER_SET_WRAPPED bool
ALTER_TABLE_INCLUDE_COLUMN_KEYWORD bool
ARRAY_CONCAT_IS_VAR_LEN bool
ARRAY_SIZE_DIM_REQUIRED Tri
ARRAY_SIZE_NAME string
CAN_IMPLEMENT_ARRAY_ANY bool
CAST_MAPPING map[DType]string
CHAR_CAST_MAPPING map[DType]string
COLLATE_IS_FUNC bool
COMPUTED_COLUMN_WITH_TYPE bool
COPY_HAS_INTO_KEYWORD bool
COPY_PARAMS_ARE_WRAPPED bool
COPY_PARAMS_EQ_REQUIRED bool
CREATE_FUNCTION_RETURN_AS bool
CTE_RECURSIVE_KEYWORD_REQUIRED bool
DATA_TYPE_SPECIFIERS_ALLOWED bool
DECLARE_DEFAULT_ASSIGNMENT string
DIRECTED_JOINS bool
DUPLICATE_KEY_UPDATE_WITH_SET bool
ENSURE_BOOLS bool
EXCEPT_INTERSECT_SUPPORT_ALL_CLAUSE bool
EXCLUDE_COMMENTS []Kind
EXPRESSIONS_WITHOUT_NESTED_CTES KindSet
EXPRESSION_PRECEDES_PROPERTIES_CREATABLES StrSet
EXTRACT_ALLOWS_QUOTES bool
EXTRACT_EPOCH_MAPPINGS map[string]string
EXTRACT_STRFTIME_MAPPINGS OptionsType
GROUPINGS_SEP string
HEX_FUNC string
HISTORICAL_DATA_POST_ALIAS bool
IGNORE_NULLS_BEFORE_ORDER bool
IGNORE_NULLS_FUNCS []Kind
IGNORE_NULLS_IN_FUNC bool
IGNORE_RESPECT_NULLS_WINDOW_FUNCTIONS []Kind
INDEX_ON string
INOUT_SEPARATOR string
INSERT_OVERWRITE string
INTERVAL_ALLOWS_PLURAL_FORM bool
IS_BOOL_ALLOWED bool
JOIN_HINTS bool
JSON_KEY_VALUE_PAIR_SEP string
JSON_PATH_BRACKETED_KEY_SUPPORTED bool
JSON_PATH_KEY_QUOTED_FORCES_BRACKETS bool
JSON_PATH_SINGLE_QUOTE_ESCAPE bool
JSON_TYPE_REQUIRED_FOR_EXTRACTION bool
LAST_DAY_SUPPORTS_DATE_PART bool
LIKE_PROPERTY_INSIDE_SCHEMA bool
LIMIT_FETCH string
LIMIT_IS_TOP bool
LIMIT_ONLY_LITERALS bool
LOCKING_READS_SUPPORTED bool
MATCHED_BY_SOURCE bool
MATCH_AGAINST_TABLE_PREFIX any
MULTI_ARG_DISTINCT bool
NAMED_PLACEHOLDER_TOKEN string
NON_NULLABLE_TYPES DTypeSet
NORMALIZE_EXTRACT_DATE_PARTS bool
NULL_ORDERING_SUPPORTED Tri
NVL2_SUPPORTED bool
ON_CLUSTER_TARGETS StrSet
PAD_FILL_PATTERN_IS_REQUIRED bool
PARAMETERIZABLE_TEXT_TYPES DTypeSet
PARAMETER_TOKEN string
PARSE_JSON_NAME string
PROPERTIES_LOCATION map[Kind]string
QUERY_HINTS bool
QUERY_HINT_SEP string
QUOTE_JSON_PATH bool
RENAME_TABLE_WITH_DB bool
RESERVED_KEYWORDS StrSet
RESPECT_IGNORE_NULLS_UNSUPPORTED_EXPRESSIONS []Kind
RETURNING_END bool
SELECT_KINDS []string
SEMI_ANTI_JOIN_WITH_SIDE bool
SENTINEL_LINE_BREAK string
SET_ASSIGNMENT_REQUIRES_VARIABLE_KEYWORD bool
SET_OP_MODIFIERS bool
SIGNED_CAST_MAPPING map[DType]string
SINGLE_STRING_INTERVAL bool
SQL_SECURITY_VIEW_LOCATION string
STAR_EXCEPT string
STAR_EXCLUDE_REQUIRES_DERIVED_TABLE bool
STRING_TYPE_MAPPING map[DType]string
STRUCT_DELIMITER []string
SUPPORTED_JSON_PATH_PARTS KindSet
SUPPORTS_BETWEEN_FLAGS bool
SUPPORTS_CHANGE_COLUMN bool
SUPPORTS_CONVERT_TIMEZONE bool
SUPPORTS_CREATE_TABLE_LIKE bool
SUPPORTS_DECODE_CASE bool
SUPPORTS_DROP_ALTER_ICEBERG_PROPERTY bool
SUPPORTS_EXPLODING_PROJECTIONS bool
SUPPORTS_LIKE_QUANTIFIERS bool
SUPPORTS_MEDIAN bool
SUPPORTS_MERGE_WHERE bool
SUPPORTS_MODIFY_COLUMN bool
SUPPORTS_NAMED_CTE_COLUMNS bool
SUPPORTS_SELECT_INTO bool
SUPPORTS_SINGLE_ARG_CONCAT bool
SUPPORTS_TABLE_ALIAS_COLUMNS bool
SUPPORTS_TABLE_COPY bool
SUPPORTS_TO_NUMBER bool
SUPPORTS_UESCAPE bool
SUPPORTS_UNIX_SECONDS bool
SUPPORTS_UNLOGGED_TABLES bool
SUPPORTS_WINDOW_EXCLUDE bool
TABLESAMPLE_KEYWORDS string
TABLESAMPLE_REQUIRES_PARENS bool
TABLESAMPLE_SEED_KEYWORD string
TABLESAMPLE_SIZE_IS_ROWS bool
TABLESAMPLE_WITH_METHOD bool
TABLE_HINTS bool
TIMESTAMP_FUNC_TYPES DTypeSet
TIMESTAMP_TYPE_MAPPING map[DType]string
TIME_PART_SINGULARS map[string]string
TOKEN_MAPPING map[TokenType]string
TRY_SUPPORTED bool
TS_OR_DS_EXPRESSIONS []Kind
TS_OR_DS_TYPES []Kind
TYPE_MAPPING map[DType]string
TYPE_PARAM_SETTINGS map[DType][][]int
TZ_TO_WITH_TIME_ZONE bool
UNICODE_SUBSTITUTE any
UNNEST_WITH_ORDINALITY bool
UNPIVOT_ALIASES_ARE_IDENTIFIERS bool
UNSIGNED_TYPE_MAPPING map[DType]string
UNSUPPORTED_TYPES StrSet
UNSUPPORTED_VALUES_EXPRESSIONS KindSet
UNWRAPPED_INTERVAL_VALUES []Kind
UPDATE_STATEMENT_SUPPORTS_FROM bool
VALUES_AS_TABLE bool
VARCHAR_REQUIRES_SIZE bool
WINDOW_FUNCS_WITH_NULL_ORDERING []Kind
WITH_PROPERTIES_PREFIX string
WITH_SEPARATED_COMMENTS []Kind
WRAP_DERIVED_VALUES bool
// contains filtered or unexported fields
}
type GeneratorSettings ¶
type GeneratorSettings struct {
*GeneratorData
// TRANSFORMS mirrors Generator.TRANSFORMS (exact class -> callable).
TRANSFORMS map[Kind]GenFunc
AFTER_HAVING_MODIFIER_TRANSFORMS map[string]GenFunc
AFTER_HAVING_MODIFIER_TRANSFORMS_KEYS []string
UNICODE_SUBSTITUTE func(g *Generator, match string) string
// contains filtered or unexported fields
}
GeneratorSettings is the fully-resolved generator configuration of a dialect.
type Kind ¶
type Kind uint16
Kind identifies a sqlglot expression class.
const ( KNone Kind = 0 KAIAgg Kind = 1 KAISummarizeAgg Kind = 2 KAnyValue Kind = 3 KApproximateSimilarity Kind = 4 KApproxPercentileAccumulate Kind = 5 KApproxPercentileCombine Kind = 6 KApproxPercentileEstimate Kind = 7 KApproxQuantiles Kind = 8 KApproxTopK Kind = 9 KApproxTopKAccumulate Kind = 10 KApproxTopKCombine Kind = 11 KApproxTopKEstimate Kind = 12 KApproxTopSum Kind = 13 KArgMax Kind = 14 KArgMin Kind = 15 KArrayAgg Kind = 16 KArrayConcatAgg Kind = 17 KArrayUnionAgg Kind = 18 KArrayUniqueAgg Kind = 19 KAvg Kind = 20 KCorr Kind = 21 KCount Kind = 22 KCountIf Kind = 23 KCovarPop Kind = 24 KCovarSamp Kind = 25 KCumeDist Kind = 26 KDenseRank Kind = 27 KFirst Kind = 28 KFirstValue Kind = 29 KGroupConcat Kind = 30 KGrouping Kind = 31 KGroupingId Kind = 32 KKurtosis Kind = 33 KLag Kind = 34 KLast Kind = 35 KLastValue Kind = 36 KLead Kind = 37 KLogicalAnd Kind = 38 KLogicalOr Kind = 39 KMax Kind = 40 KMedian Kind = 41 KMin Kind = 42 KMinhash Kind = 43 KMinhashCombine Kind = 44 KMode Kind = 45 KNtile Kind = 46 KNthValue Kind = 47 KObjectAgg Kind = 48 KPercentileCont Kind = 49 KPercentileDisc Kind = 50 KPercentRank Kind = 51 KQuantile Kind = 52 KApproxQuantile Kind = 53 KRank Kind = 54 KRegrAvgx Kind = 55 KRegrAvgy Kind = 56 KRegrCount Kind = 57 KRegrIntercept Kind = 58 KRegrR2 Kind = 59 KRegrSlope Kind = 60 KRegrSxx Kind = 61 KRegrSxy Kind = 62 KRegrSyy Kind = 63 KRegrValx Kind = 64 KRegrValy Kind = 65 KRowNumber Kind = 66 KSkewness Kind = 67 KStddev Kind = 68 KStddevPop Kind = 69 KStddevSamp Kind = 70 KSum Kind = 71 KVariance Kind = 72 KVariancePop Kind = 73 KArray Kind = 74 KArrayConstructCompact Kind = 75 KList Kind = 76 KToArray Kind = 77 KArrayAppend Kind = 78 KArrayCompact Kind = 79 KArrayConcat Kind = 80 KArrayFilter Kind = 81 KArrayInsert Kind = 82 KArrayPrepend Kind = 83 KArrayRemove Kind = 84 KArrayRemoveAt Kind = 85 KArrayReverse Kind = 86 KArraySlice Kind = 87 KArraySort Kind = 88 KSortArray Kind = 89 KArrayAll Kind = 90 KArrayAny Kind = 91 KArrayContains Kind = 92 KArrayContainsAll Kind = 93 KArrayContainedBy Kind = 94 KArrayExcept Kind = 95 KArrayIntersect Kind = 96 KArrayOverlaps Kind = 97 KArrayPosition Kind = 98 KArrayDistinct Kind = 99 KArrayFirst Kind = 100 KArrayLast Kind = 101 KArrayMax Kind = 102 KArrayMin Kind = 103 KArraySize Kind = 104 KArraySum Kind = 105 KArraysZip Kind = 106 KArrayToString Kind = 107 KFlatten Kind = 108 KStringToArray Kind = 109 KStrtokToArray Kind = 110 KApply Kind = 111 KReduce Kind = 112 KTransform Kind = 113 KGenerateSeries Kind = 114 KExplodingGenerateSeries Kind = 115 KGenerator Kind = 116 KExplode Kind = 117 KInline Kind = 118 KExplodeOuter Kind = 119 K_ExplodeOuter Kind = 120 KPosexplode Kind = 121 KPosexplodeOuter Kind = 122 KPositionalColumn Kind = 123 KUnnest Kind = 124 KMap Kind = 125 KMapCat Kind = 126 KMapContainsKey Kind = 127 KMapDelete Kind = 128 KMapFromEntries Kind = 129 KMapInsert Kind = 130 KMapKeys Kind = 131 KMapPick Kind = 132 KMapSize Kind = 133 KStarMap Kind = 134 KToMap Kind = 135 KVarMap Kind = 136 KStruct Kind = 137 KStructExtract Kind = 138 KStDistance Kind = 139 KStPoint Kind = 140 KIndexConstraintOption Kind = 141 KReference Kind = 142 KColumnConstraint Kind = 143 KAutoIncrementColumnConstraint Kind = 144 KInvisibleColumnConstraint Kind = 145 KZeroFillColumnConstraint Kind = 146 KPeriodForSystemTimeConstraint Kind = 147 KCaseSpecificColumnConstraint Kind = 148 KCharacterSetColumnConstraint Kind = 149 KCheckColumnConstraint Kind = 150 KAssumeColumnConstraint Kind = 151 KClusteredColumnConstraint Kind = 152 KCollateColumnConstraint Kind = 153 KCommentColumnConstraint Kind = 154 KCompressColumnConstraint Kind = 155 KDateFormatColumnConstraint Kind = 156 KDefaultColumnConstraint Kind = 157 KEncodeColumnConstraint Kind = 158 KExcludeColumnConstraint Kind = 159 KEphemeralColumnConstraint Kind = 160 KWithOperator Kind = 161 KGeneratedAsIdentityColumnConstraint Kind = 162 KGeneratedAsRowColumnConstraint Kind = 163 KIndexColumnConstraint Kind = 164 KInlineLengthColumnConstraint Kind = 165 KNonClusteredColumnConstraint Kind = 166 KNotForReplicationColumnConstraint Kind = 167 KMaskingPolicyColumnConstraint Kind = 168 KNotNullColumnConstraint Kind = 169 KOnUpdateColumnConstraint Kind = 170 KPrimaryKeyColumnConstraint Kind = 171 KTitleColumnConstraint Kind = 172 KUniqueColumnConstraint Kind = 173 KUppercaseColumnConstraint Kind = 174 KWatermarkColumnConstraint Kind = 175 KPathColumnConstraint Kind = 176 KProjectionPolicyColumnConstraint Kind = 177 KComputedColumnConstraint Kind = 178 KInOutColumnConstraint Kind = 179 KConstraint Kind = 180 KForeignKey Kind = 181 KColumnPrefix Kind = 182 KPrimaryKey Kind = 183 KTimeseriesKey Kind = 184 KIndexParameters Kind = 185 KAddConstraint Kind = 186 KExpr Kind = 187 KExpression Kind = 188 KCondition Kind = 189 KPredicate Kind = 190 KCache Kind = 191 KUncache Kind = 192 KRefresh Kind = 193 KLockingStatement Kind = 194 KColumnConstraintKind Kind = 195 KSubqueryPredicate Kind = 196 KAll Kind = 197 KAny Kind = 198 KBinary Kind = 199 KConnector Kind = 200 KFunc Kind = 201 KAggFunc Kind = 202 KColumn Kind = 203 KLiteral Kind = 204 KVar Kind = 205 KWithinGroup Kind = 206 KPseudocolumn Kind = 207 KHint Kind = 208 KJoinHint Kind = 209 KIdentifier Kind = 210 KDynamicIdentifier Kind = 211 KOpclass Kind = 212 KStar Kind = 213 KParameter Kind = 214 KSessionParameter Kind = 215 KPlaceholder Kind = 216 KNull Kind = 217 KBoolean Kind = 218 KDot Kind = 219 KKwarg Kind = 220 KAlias Kind = 221 KPivotAlias Kind = 222 KPivotAny Kind = 223 KAliases Kind = 224 KBracket Kind = 225 KForIn Kind = 226 KIgnoreNulls Kind = 227 KRespectNulls Kind = 228 KHavingMax Kind = 229 KSafeFunc Kind = 230 KTypeof Kind = 231 KParameterizedAgg Kind = 232 KAnonymous Kind = 233 KAnonymousAggFunc Kind = 234 KCombinedAggFunc Kind = 235 KCombinedParameterizedAgg Kind = 236 KHashAgg Kind = 237 KHll Kind = 238 KApproxDistinct Kind = 239 KSlice Kind = 240 KTimeUnit Kind = 241 K_TimeUnit Kind = 242 KIntervalOp Kind = 243 KFilter Kind = 244 KCheck Kind = 245 KOrdered Kind = 246 KAdd Kind = 247 KBitwiseAnd Kind = 248 KBitwiseLeftShift Kind = 249 KBitwiseOr Kind = 250 KBitwiseRightShift Kind = 251 KBitwiseXor Kind = 252 KDiv Kind = 253 KOverlaps Kind = 254 KExtendsLeft Kind = 255 KExtendsRight Kind = 256 KDPipe Kind = 257 KEQ Kind = 258 KNullSafeEQ Kind = 259 KNullSafeNEQ Kind = 260 KPropertyEQ Kind = 261 KDistance Kind = 262 KDistanceNd Kind = 263 KEscape Kind = 264 KGlob Kind = 265 KGT Kind = 266 KGTE Kind = 267 KILike Kind = 268 KIntDiv Kind = 269 KIs Kind = 270 KLike Kind = 271 KMatch Kind = 272 KLT Kind = 273 KLTE Kind = 274 KMod Kind = 275 KMul Kind = 276 KNEQ Kind = 277 KNestedJSONSelect Kind = 278 KOperator Kind = 279 KSimilarTo Kind = 280 KSub Kind = 281 KAdjacent Kind = 282 KUnary Kind = 283 KBitwiseNot Kind = 284 KNot Kind = 285 KParen Kind = 286 KNeg Kind = 287 KAtIndex Kind = 288 KAtTimeZone Kind = 289 KFromTimeZone Kind = 290 KFormatPhrase Kind = 291 KBetween Kind = 292 KDistinct Kind = 293 KIn Kind = 294 KAnd Kind = 295 KOr Kind = 296 KXor Kind = 297 KPow Kind = 298 KRegexpLike Kind = 299 KDataTypeParam Kind = 300 KDataType Kind = 301 KPseudoType Kind = 302 KObjectIdentifier Kind = 303 KIntervalSpan Kind = 304 KInterval Kind = 305 KDDL Kind = 306 KCreate Kind = 307 KSequenceProperties Kind = 308 KTriggerProperties Kind = 309 KTriggerExecute Kind = 310 KTriggerEvent Kind = 311 KTriggerReferencing Kind = 312 KTruncateTable Kind = 313 KClone Kind = 314 KDescribe Kind = 315 KAttach Kind = 316 KDetach Kind = 317 KInstall Kind = 318 KSummarize Kind = 319 KKill Kind = 320 KPragma Kind = 321 KDeclare Kind = 322 KDeclareItem Kind = 323 KSet Kind = 324 KHeredoc Kind = 325 KSetItem Kind = 326 KShow Kind = 327 KUserDefinedFunction Kind = 328 KMacroOverloads Kind = 329 KMacroOverload Kind = 330 KCharacterSet Kind = 331 KAlterColumn Kind = 332 KModifyColumn Kind = 333 KAlterIndex Kind = 334 KAlterDistStyle Kind = 335 KAlterSortKey Kind = 336 KAlterSet Kind = 337 KRenameColumn Kind = 338 KAlterRename Kind = 339 KRenameIndex Kind = 340 KAlterModifySqlSecurity Kind = 341 KSwapTable Kind = 342 KComment Kind = 343 KComprehension Kind = 344 KMergeTreeTTLAction Kind = 345 KMergeTreeTTL Kind = 346 KDrop Kind = 347 KDropPrimaryKey Kind = 348 KUndrop Kind = 349 KCommand Kind = 350 KTransaction Kind = 351 KCommit Kind = 352 KRollback Kind = 353 KAlter Kind = 354 KAlterSession Kind = 355 KUse Kind = 356 KNextValueFor Kind = 357 KExecute Kind = 358 KExecuteSql Kind = 359 KDML Kind = 360 KDelete Kind = 361 KExport Kind = 362 KCopyParameter Kind = 363 KCopy Kind = 364 KCredentials Kind = 365 KDirectory Kind = 366 KDirectoryStage Kind = 367 KInsert Kind = 368 KOnConflict Kind = 369 KReturning Kind = 370 KLoadData Kind = 371 KUpdate Kind = 372 KMerge Kind = 373 KWhen Kind = 374 KWhens Kind = 375 KCast Kind = 376 KTryCast Kind = 377 KJSONCast Kind = 378 KCastToStrType Kind = 379 KConvert Kind = 380 KIf Kind = 381 KCase Kind = 382 KCoalesce Kind = 383 KDecodeCase Kind = 384 KEqualNull Kind = 385 KGreatest Kind = 386 KLeast Kind = 387 KNullif Kind = 388 KObjectTransform Kind = 389 KNvl2 Kind = 390 KTry Kind = 391 KCollate Kind = 392 KCollation Kind = 393 KConnectByRoot Kind = 394 KCheckXml Kind = 395 KExists Kind = 396 KFloat64 Kind = 397 KInt64 Kind = 398 KIsArray Kind = 399 KIsNullValue Kind = 400 KLaxBool Kind = 401 KLaxFloat64 Kind = 402 KLaxInt64 Kind = 403 KLaxString Kind = 404 KToBoolean Kind = 405 KToVariant Kind = 406 KCurrentAccount Kind = 407 KCurrentAccountName Kind = 408 KCurrentAvailableRoles Kind = 409 KCurrentCatalog Kind = 410 KCurrentClient Kind = 411 KCurrentDatabase Kind = 412 KCurrentIpAddress Kind = 413 KCurrentOrganizationName Kind = 414 KCurrentOrganizationUser Kind = 415 KCurrentRegion Kind = 416 KCurrentRole Kind = 417 KCurrentRoleType Kind = 418 KCurrentSchema Kind = 419 KCurrentSchemas Kind = 420 KCurrentSecondaryRoles Kind = 421 KCurrentSession Kind = 422 KCurrentStatement Kind = 423 KCurrentTransaction Kind = 424 KCurrentUser Kind = 425 KCurrentUserId Kind = 426 KCurrentVersion Kind = 427 KCurrentWarehouse Kind = 428 KSessionUser Kind = 429 KAIClassify Kind = 430 KAIEmbed Kind = 431 KAISimilarity Kind = 432 KAIGenerate Kind = 433 KFeaturesAtTime Kind = 434 KGenerateEmbedding Kind = 435 KGenerateText Kind = 436 KGenerateTable Kind = 437 KGenerateBool Kind = 438 KGenerateInt Kind = 439 KGenerateDouble Kind = 440 KMLForecast Kind = 441 KAIForecast Kind = 442 KMLTranslate Kind = 443 KPredict Kind = 444 KVectorSearch Kind = 445 KReadCSV Kind = 446 KReadParquet Kind = 447 KXMLElement Kind = 448 KGetIgnoreCase Kind = 449 KXMLGet Kind = 450 KXMLTable Kind = 451 KHost Kind = 452 KNetFunc Kind = 453 KParseIp Kind = 454 KRegDomain Kind = 455 KColumns Kind = 456 KNormal Kind = 457 KRand Kind = 458 KRandn Kind = 459 KRandstr Kind = 460 KRangeBucket Kind = 461 KRangeN Kind = 462 KSeq1 Kind = 463 KSeq2 Kind = 464 KSeq4 Kind = 465 KSeq8 Kind = 466 KUniform Kind = 467 KUuid Kind = 468 KWeekStart Kind = 469 KWidthBucket Kind = 470 KZipf Kind = 471 KCheckJson Kind = 472 KJSONArray Kind = 473 KJSONArrayAgg Kind = 474 KJSONArrayAppend Kind = 475 KJSONArrayContains Kind = 476 KJSONArrayInsert Kind = 477 KJSONBContains Kind = 478 KJSONBContainsAllTopKeys Kind = 479 KJSONBContainsAnyTopKeys Kind = 480 KJSONBDeleteAtPath Kind = 481 KJSONBPathExists Kind = 482 KJSONBExists Kind = 483 KJSONBExtract Kind = 484 KJSONBExtractScalar Kind = 485 KJSONBObjectAgg Kind = 486 KJSONBool Kind = 487 KJSONExists Kind = 488 KJSONExtract Kind = 489 KJSONExtractArray Kind = 490 KJSONExtractScalar Kind = 491 KJSONFormat Kind = 492 KJSONKeys Kind = 493 KJSONKeysAtDepth Kind = 494 KJSONObject Kind = 495 KJSONObjectAgg Kind = 496 KJSONRemove Kind = 497 KJSONSet Kind = 498 KJSONStripNulls Kind = 499 KStripNullValue Kind = 500 KJSONTable Kind = 501 KJSONType Kind = 502 KObjectId Kind = 503 KObjectInsert Kind = 504 KOpenJSON Kind = 505 KParseJSON Kind = 506 KAcos Kind = 507 KAcosh Kind = 508 KAsin Kind = 509 KAsinh Kind = 510 KAtan Kind = 511 KAtanh Kind = 512 KAtan2 Kind = 513 KCos Kind = 514 KCosh Kind = 515 KCot Kind = 516 KCoth Kind = 517 KCsc Kind = 518 KCsch Kind = 519 KDegrees Kind = 520 KRadians Kind = 521 KSec Kind = 522 KSech Kind = 523 KSin Kind = 524 KSinh Kind = 525 KTan Kind = 526 KTanh Kind = 527 KCosineDistance Kind = 528 KDotProduct Kind = 529 KEuclideanDistance Kind = 530 KJarowinklerSimilarity Kind = 531 KManhattanDistance Kind = 532 KAbs Kind = 533 KCbrt Kind = 534 KCeil Kind = 535 KExp Kind = 536 KFactorial Kind = 537 KFloor Kind = 538 KIsInf Kind = 539 KIsNan Kind = 540 KLn Kind = 541 KLog Kind = 542 KPi Kind = 543 KRint Kind = 544 KRound Kind = 545 KSign Kind = 546 KSqrt Kind = 547 KTrunc Kind = 548 KSafeAdd Kind = 549 KSafeDivide Kind = 550 KSafeMultiply Kind = 551 KSafeNegate Kind = 552 KSafeSubtract Kind = 553 KBitwiseAndAgg Kind = 554 KBitwiseCount Kind = 555 KBitwiseOrAgg Kind = 556 KBitwiseXorAgg Kind = 557 KBitmapBitPosition Kind = 558 KBitmapBucketNumber Kind = 559 KBitmapConstructAgg Kind = 560 KBitmapCount Kind = 561 KBitmapOrAgg Kind = 562 KBooland Kind = 563 KBoolnot Kind = 564 KBoolor Kind = 565 KBoolxorAgg Kind = 566 KGetbit Kind = 567 KProperty Kind = 568 KGrantPrivilege Kind = 569 KGrantPrincipal Kind = 570 KAllowedValuesProperty Kind = 571 KAlgorithmProperty Kind = 572 KApiProperty Kind = 573 KApplicationProperty Kind = 574 KAutoIncrementProperty Kind = 575 KAutoRefreshProperty Kind = 576 KBackupProperty Kind = 577 KBuildProperty Kind = 578 KBlockCompressionProperty Kind = 579 KCalledOnNullInputProperty Kind = 580 KCatalogProperty Kind = 581 KCharacterSetProperty Kind = 582 KChecksumProperty Kind = 583 KClusterProperty Kind = 584 KCollateProperty Kind = 585 KComputeProperty Kind = 586 KCopyGrantsProperty Kind = 587 KDataBlocksizeProperty Kind = 588 KDataDeletionProperty Kind = 589 KDatabaseProperty Kind = 590 KDefinerProperty Kind = 591 KDistKeyProperty Kind = 592 KDistributedByProperty Kind = 593 KDistStyleProperty Kind = 594 KDuplicateKeyProperty Kind = 595 KEngineProperty Kind = 596 KUuidProperty Kind = 597 KHeapProperty Kind = 598 KHybridProperty Kind = 599 KHandlerProperty Kind = 600 KParameterStyleProperty Kind = 601 KToTableProperty Kind = 602 KExecuteAsProperty Kind = 603 KExternalProperty Kind = 604 KFallbackProperty Kind = 605 KFileFormatProperty Kind = 606 KCredentialsProperty Kind = 607 KFreespaceProperty Kind = 608 KGlobalProperty Kind = 609 KIcebergProperty Kind = 610 KInheritsProperty Kind = 611 KInputModelProperty Kind = 612 KOutputModelProperty Kind = 613 KIsolatedLoadingProperty Kind = 614 KJournalProperty Kind = 615 KLanguageProperty Kind = 616 KEnviromentProperty Kind = 617 KClusteredByProperty Kind = 618 KDictProperty Kind = 619 KDictSubProperty Kind = 620 KDictRange Kind = 621 KDynamicProperty Kind = 622 KOnCluster Kind = 623 KEmptyProperty Kind = 624 KLikeProperty Kind = 625 KLocationProperty Kind = 626 KLockProperty Kind = 627 KLockingProperty Kind = 628 KLogProperty Kind = 629 KMaskingProperty Kind = 630 KMaterializedProperty Kind = 631 KMergeBlockRatioProperty Kind = 632 KModuleProperty Kind = 633 KNetworkProperty Kind = 634 KNoPrimaryIndexProperty Kind = 635 KOnProperty Kind = 636 KOnCommitProperty Kind = 637 KPartitionedByProperty Kind = 638 KPartitionedByBucket Kind = 639 KPartitionByTruncate Kind = 640 KPartitionByRangeProperty Kind = 641 KPartitionByRangePropertyDynamic Kind = 642 KRollupProperty Kind = 643 KRollupIndex Kind = 644 KRowAccessProperty Kind = 645 KPartitionByListProperty Kind = 646 KPartitionList Kind = 647 KRefreshTriggerProperty Kind = 648 KUniqueKeyProperty Kind = 649 KPartitionBoundSpec Kind = 650 KPartitionedOfProperty Kind = 651 KStreamingTableProperty Kind = 652 KRemoteWithConnectionModelProperty Kind = 653 KReturnsProperty Kind = 654 KStrictProperty Kind = 655 KRowFormatProperty Kind = 656 KRowFormatDelimitedProperty Kind = 657 KRowFormatSerdeProperty Kind = 658 KQueryTransform Kind = 659 KSampleProperty Kind = 660 KSchemaCommentProperty Kind = 661 KSemanticView Kind = 662 KSerdeProperties Kind = 663 KSetProperty Kind = 664 KSharingProperty Kind = 665 KSetConfigProperty Kind = 666 KSettingsProperty Kind = 667 KSortKeyProperty Kind = 668 KSqlReadWriteProperty Kind = 669 KSqlSecurityProperty Kind = 670 KStabilityProperty Kind = 671 KStorageHandlerProperty Kind = 672 KUsingProperty Kind = 673 KTemporaryProperty Kind = 674 KVirtualProperty Kind = 675 KSecureProperty Kind = 676 KSecurityIntegrationProperty Kind = 677 KTags Kind = 678 KTransformModelProperty Kind = 679 KTransientProperty Kind = 680 KUnloggedProperty Kind = 681 KUsingTemplateProperty Kind = 682 KViewAttributeProperty Kind = 683 KVolatileProperty Kind = 684 KWithDataProperty Kind = 685 KWithJournalTableProperty Kind = 686 KWithSchemaBindingProperty Kind = 687 KWithSystemVersioningProperty Kind = 688 KWithProcedureOptions Kind = 689 KEncodeProperty Kind = 690 KIncludeProperty Kind = 691 KForceProperty Kind = 692 KProperties Kind = 693 KSelectable Kind = 694 KDerivedTable Kind = 695 KUDTF Kind = 696 KQuery Kind = 697 KQueryBand Kind = 698 KRecursiveWithSearch Kind = 699 KWith Kind = 700 KCTE Kind = 701 KProjectionDef Kind = 702 KTableAlias Kind = 703 KBitString Kind = 704 KHexString Kind = 705 KByteString Kind = 706 KRawString Kind = 707 KUnicodeString Kind = 708 KColumnPosition Kind = 709 KColumnDef Kind = 710 KChanges Kind = 711 KConnect Kind = 712 KPrior Kind = 713 KInto Kind = 714 KFrom Kind = 715 KHaving Kind = 716 KIndex Kind = 717 KConditionalInsert Kind = 718 KMultitableInserts Kind = 719 KOnCondition Kind = 720 KIntroducer Kind = 721 KNational Kind = 722 KPartition Kind = 723 KPartitionRange Kind = 724 KPartitionId Kind = 725 KFetch Kind = 726 KGrant Kind = 727 KRevoke Kind = 728 KGroup Kind = 729 KCube Kind = 730 KRollup Kind = 731 KGroupingSets Kind = 732 KLambda Kind = 733 KLimit Kind = 734 KLimitOptions Kind = 735 KJoin Kind = 736 KLateral Kind = 737 KTableFromRows Kind = 738 KMatchRecognizeMeasure Kind = 739 KMatchRecognize Kind = 740 KFinal Kind = 741 KOffset Kind = 742 KOrder Kind = 743 KWithFill Kind = 744 KSkipJSONColumn Kind = 745 KCluster Kind = 746 KDistribute Kind = 747 KSort Kind = 748 KQualify Kind = 749 KInputOutputFormat Kind = 750 KReturn Kind = 751 KTuple Kind = 752 KQueryOption Kind = 753 KForClause Kind = 754 KWithTableHint Kind = 755 KIndexTableHint Kind = 756 KHistoricalData Kind = 757 KPut Kind = 758 KGet Kind = 759 KTable Kind = 760 KSetOperation Kind = 761 KUnion Kind = 762 KExcept Kind = 763 KIntersect Kind = 764 KValues Kind = 765 KVersion Kind = 766 KSchema Kind = 767 KLock Kind = 768 KSelect Kind = 769 KSubquery Kind = 770 KTableSample Kind = 771 KTag Kind = 772 KPivot Kind = 773 KUnpivotColumns Kind = 774 KWindow Kind = 775 KWindowSpec Kind = 776 KPreWhere Kind = 777 KWhere Kind = 778 KAnalyze Kind = 779 KAnalyzeStatistics Kind = 780 KAnalyzeHistogram Kind = 781 KAnalyzeSample Kind = 782 KAnalyzeListChainedRows Kind = 783 KAnalyzeDelete Kind = 784 KAnalyzeWith Kind = 785 KAnalyzeValidate Kind = 786 KAnalyzeColumns Kind = 787 KUsingData Kind = 788 KAddPartition Kind = 789 KAttachOption Kind = 790 KDropPartition Kind = 791 KReplacePartition Kind = 792 KTranslateCharacters Kind = 793 KOverflowTruncateBehavior Kind = 794 KJSON Kind = 795 KJSONPath Kind = 796 KJSONPathPart Kind = 797 KJSONPathFilter Kind = 798 KJSONPathKey Kind = 799 KJSONPathRecursive Kind = 800 KJSONPathRoot Kind = 801 KJSONPathScript Kind = 802 KJSONPathSlice Kind = 803 KJSONPathSelector Kind = 804 KJSONPathSubscript Kind = 805 KJSONPathUnion Kind = 806 KJSONPathWildcard Kind = 807 KFormatJson Kind = 808 KJSONKeyValue Kind = 809 KJSONColumnDef Kind = 810 KJSONSchema Kind = 811 KJSONValue Kind = 812 KJSONValueArray Kind = 813 KOpenJSONColumnDef Kind = 814 KJSONExtractQuote Kind = 815 KScopeResolution Kind = 816 KStream Kind = 817 KModelAttribute Kind = 818 KXMLNamespace Kind = 819 KXMLKeyValueOption Kind = 820 KSemicolon Kind = 821 KTableColumn Kind = 822 KVariadic Kind = 823 KStoredProcedure Kind = 824 KBlock Kind = 825 KIfBlock Kind = 826 KWhileBlock Kind = 827 KEndStatement Kind = 828 KAscii Kind = 829 KBitLength Kind = 830 KByteLength Kind = 831 KChr Kind = 832 KConcat Kind = 833 KConcatWs Kind = 834 KContains Kind = 835 KElt Kind = 836 KEndsWith Kind = 837 KFormat Kind = 838 KInitcap Kind = 839 KIsAscii Kind = 840 KLeft Kind = 841 KLength Kind = 842 KLevenshtein Kind = 843 KLower Kind = 844 KMatchAgainst Kind = 845 KNormalize Kind = 846 KNumberToStr Kind = 847 KOverlay Kind = 848 KPad Kind = 849 KRepeat Kind = 850 KReplace Kind = 851 KReverse Kind = 852 KRight Kind = 853 KRtrimmedLength Kind = 854 KSearch Kind = 855 KSearchIp Kind = 856 KSoundex Kind = 857 KSoundexP123 Kind = 858 KSpace Kind = 859 KSplit Kind = 860 KSplitPart Kind = 861 KStrtok Kind = 862 KStartsWith Kind = 863 KStrPosition Kind = 864 KStrToMap Kind = 865 KString Kind = 866 KStuff Kind = 867 KSubstring Kind = 868 KSubstringIndex Kind = 869 KTranslate Kind = 870 KTrim Kind = 871 KUnicode Kind = 872 KUpper Kind = 873 KBase64DecodeBinary Kind = 874 KBase64DecodeString Kind = 875 KBase64Encode Kind = 876 KCodePointsToBytes Kind = 877 KCodePointsToString Kind = 878 KConvertToCharset Kind = 879 KDecode Kind = 880 KEncode Kind = 881 KFromBase Kind = 882 KFromBase32 Kind = 883 KFromBase64 Kind = 884 KHex Kind = 885 KHexDecodeString Kind = 886 KLowerHex Kind = 887 KSafeConvertBytesToString Kind = 888 KToBase32 Kind = 889 KToBase64 Kind = 890 KToBinary Kind = 891 KToChar Kind = 892 KToCodePoints Kind = 893 KToDecfloat Kind = 894 KToDouble Kind = 895 KToFile Kind = 896 KToNumber Kind = 897 KTryBase64DecodeBinary Kind = 898 KTryBase64DecodeString Kind = 899 KTryHexDecodeBinary Kind = 900 KTryHexDecodeString Kind = 901 KTryToDecfloat Kind = 902 KUnhex Kind = 903 KRegexpCount Kind = 904 KRegexpExtract Kind = 905 KRegexpExtractAll Kind = 906 KRegexpFullMatch Kind = 907 KRegexpILike Kind = 908 KRegexpInstr Kind = 909 KRegexpReplace Kind = 910 KRegexpSplit Kind = 911 KRegexpSubstr Kind = 912 KCompress Kind = 913 KDecrypt Kind = 914 KDecryptRaw Kind = 915 KDecompressBinary Kind = 916 KDecompressString Kind = 917 KEncrypt Kind = 918 KEncryptRaw Kind = 919 KCityHash64 Kind = 920 KFarmFingerprint Kind = 921 KMD5 Kind = 922 KMD5Digest Kind = 923 KMD5NumberLower64 Kind = 924 KMD5NumberUpper64 Kind = 925 KSHA Kind = 926 KSHA1Digest Kind = 927 KSHA2 Kind = 928 KSHA2Digest Kind = 929 KStandardHash Kind = 930 KParseBignumeric Kind = 931 KParseNumeric Kind = 932 KParseUrl Kind = 933 KCurrentDate Kind = 934 KCurrentDatetime Kind = 935 KCurrentTime Kind = 936 KCurrentTimestamp Kind = 937 KCurrentTimestampLTZ Kind = 938 KCurrentTimezone Kind = 939 KLocaltime Kind = 940 KLocaltimestamp Kind = 941 KSystimestamp Kind = 942 KUtcDate Kind = 943 KUtcTime Kind = 944 KUtcTimestamp Kind = 945 KAddMonths Kind = 946 KDateAdd Kind = 947 KDateBin Kind = 948 KDateDiff Kind = 949 KDateSub Kind = 950 KDatetimeAdd Kind = 951 KDatetimeDiff Kind = 952 KDatetimeSub Kind = 953 KMonthsBetween Kind = 954 KTimeAdd Kind = 955 KTimeDiff Kind = 956 KTimeSub Kind = 957 KTimestampAdd Kind = 958 KTimestampDiff Kind = 959 KTimestampSub Kind = 960 KTsOrDsAdd Kind = 961 KTsOrDsDiff Kind = 962 KDatetimeTrunc Kind = 963 KDateTrunc Kind = 964 KTimestampTrunc Kind = 965 KTimeSlice Kind = 966 KTimeTrunc Kind = 967 KDay Kind = 968 KDayOfMonth Kind = 969 KDayOfWeek Kind = 970 KDayOfWeekIso Kind = 971 KDayOfYear Kind = 972 KDayname Kind = 973 KExtract Kind = 974 KGetExtract Kind = 975 KHour Kind = 976 KMinute Kind = 977 KMonth Kind = 978 KMonthname Kind = 979 KQuarter Kind = 980 KSecond Kind = 981 KToDays Kind = 982 KWeek Kind = 983 KWeekOfYear Kind = 984 KYear Kind = 985 KYearOfWeek Kind = 986 KYearOfWeekIso Kind = 987 KDate Kind = 988 KDateFromParts Kind = 989 KDateFromUnixDate Kind = 990 KDatetime Kind = 991 KGapFill Kind = 992 KGenerateDateArray Kind = 993 KGenerateTimestampArray Kind = 994 KJustifyDays Kind = 995 KJustifyHours Kind = 996 KJustifyInterval Kind = 997 KLastDay Kind = 998 KMakeInterval Kind = 999 KNextDay Kind = 1000 KPreviousDay Kind = 1001 KTime Kind = 1002 KTimeFromParts Kind = 1003 KTimestamp Kind = 1004 KTimestampFromParts Kind = 1005 KTimestampLtzFromParts Kind = 1006 KTimestampTzFromParts Kind = 1007 KConvertTimezone Kind = 1008 KDateStrToDate Kind = 1009 KDateToDateStr Kind = 1010 KDateToDi Kind = 1011 KDiToDate Kind = 1012 KFromISO8601Timestamp Kind = 1013 KFromISO8601Date Kind = 1014 KFromISO8601TimestampNanos Kind = 1015 KParseDatetime Kind = 1016 KParseTime Kind = 1017 KStrToDate Kind = 1018 KStrToTime Kind = 1019 KStrToUnix Kind = 1020 KTimeStrToDate Kind = 1021 KTimeStrToTime Kind = 1022 KTimeStrToUnix Kind = 1023 KTimeToStr Kind = 1024 KTimeToTimeStr Kind = 1025 KTimeToUnix Kind = 1026 KTsOrDiToDi Kind = 1027 KTsOrDsToDate Kind = 1028 KTsOrDsToDateStr Kind = 1029 KTsOrDsToDatetime Kind = 1030 KTsOrDsToTime Kind = 1031 KTsOrDsToTimestamp Kind = 1032 KUnixDate Kind = 1033 KUnixMicros Kind = 1034 KUnixMillis Kind = 1035 KUnixSeconds Kind = 1036 KUnixToStr Kind = 1037 KUnixToTime Kind = 1038 KUnixToTimeStr Kind = 1039 )
func (Kind) ArgTypes ¶
func (k Kind) ArgTypes() []argSpec
ArgTypes returns the ordered argument specs.
type KindSet ¶
type KindSet struct {
// contains filtered or unexported fields
}
KindSet is a bitset of expression kinds.
type LineageError ¶
type LineageError struct{ Msg string }
LineageError mirrors sqlglot.errors.SqlglotError raised by lineage.
func (*LineageError) Error ¶
func (e *LineageError) Error() string
type LineageNode ¶
type LineageNode struct {
Name string
Expression *Expr
Source *Expr
Downstream []*LineageNode
SourceName string
ReferenceNodeName string
}
LineageNode mirrors sqlglot.lineage.Node.
func LineageColumn ¶
func LineageColumn(column string, expression *Expr, opts LineageOptions) (node *LineageNode, err error)
LineageColumn mirrors lineage(column, sql, ...).
func (*LineageNode) Walk ¶
func (n *LineageNode) Walk() []*LineageNode
Walk mirrors Node.walk (DFS, visiting each node once).
type LineageOptions ¶
type LineageOptions struct {
Schema *MappingSchema
Dialect *Dialect
Scope *Scope
TrimSelects bool
Copy bool
}
LineageOptions configures Lineage.
type MappingSchema ¶
type MappingSchema struct {
// contains filtered or unexported fields
}
MappingSchema mirrors sqlglot.schema.MappingSchema.
func NewMappingSchema ¶
func NewMappingSchema(schema *SchemaMap, visible *SchemaMap, dialect *Dialect, normalize bool, udfMapping *SchemaMap) *MappingSchema
NewMappingSchema mirrors MappingSchema(schema, visible, dialect, normalize, udf_mapping).
func (*MappingSchema) AddTable ¶
func (s *MappingSchema) AddTable(table *Expr, columnMapping *SchemaMap, dialect *Dialect, normalize *bool, matchDepth bool)
AddTable mirrors MappingSchema.add_table for an already-built Table expression.
func (*MappingSchema) ColumnNames ¶
func (s *MappingSchema) ColumnNames(table *Expr, onlyVisible bool, dialect *Dialect, normalize *bool) []string
ColumnNames mirrors MappingSchema.column_names.
func (*MappingSchema) Depth ¶
func (s *MappingSchema) Depth() int
Depth mirrors MappingSchema.depth.
func (*MappingSchema) Dialect ¶
func (s *MappingSchema) Dialect() *Dialect
Dialect returns the schema dialect.
func (*MappingSchema) Empty ¶
func (s *MappingSchema) Empty() bool
Empty mirrors AbstractMappingSchema.empty.
func (*MappingSchema) Find ¶
func (s *MappingSchema) Find(table *Expr, raiseOnMissing bool, ensureDataTypes bool) *SchemaMap
Find mirrors MappingSchema.find.
func (*MappingSchema) GetColumnType ¶
func (s *MappingSchema) GetColumnType(table *Expr, column *Expr, columnName string, dialect *Dialect, normalize *bool) *Expr
GetColumnType mirrors MappingSchema.get_column_type.
func (*MappingSchema) GetUDFType ¶
func (s *MappingSchema) GetUDFType(udf *Expr, dialect *Dialect, normalize *bool) *Expr
GetUDFType mirrors MappingSchema.get_udf_type for an Anonymous expression.
func (*MappingSchema) HasColumn ¶
func (s *MappingSchema) HasColumn(table *Expr, column *Expr, columnName string, dialect *Dialect, normalize *bool) bool
HasColumn mirrors MappingSchema.has_column.
func (*MappingSchema) SupportedTableArgs ¶
func (s *MappingSchema) SupportedTableArgs() []string
SupportedTableArgs mirrors AbstractMappingSchema.supported_table_args.
func (*MappingSchema) TableFromString ¶
func (s *MappingSchema) TableFromString(name string, dialect *Dialect) *Expr
TableFromString parses a table path the way maybe_parse(str, into=exp.Table) does.
type OptimizeContext ¶
type OptimizeContext struct {
Schema *MappingSchema
Dialect *Dialect
// Db and Catalog are the default database/catalog ("" means None).
Db string
Catalog string
// SQL is the original SQL string for error highlighting ("" means None).
SQL string
// Kwargs mirrors **kwargs (keys are the Python parameter names, e.g. "expand_stars",
// "leave_tables_isolated"). Values must have the Go type of the matching option.
Kwargs map[string]any
}
OptimizeContext carries the arguments of sqlglot.optimizer.optimize that are forwarded to the rules: Python passes each rule the keyword arguments its signature accepts among db, catalog, schema, dialect, sql, isolate_tables=True, quote_identifiers=False and **kwargs.
type OptimizeError ¶
type OptimizeError struct{ Msg string }
OptimizeError mirrors sqlglot.errors.OptimizeError.
func (*OptimizeError) Error ¶
func (e *OptimizeError) Error() string
type OptimizerRule ¶
type OptimizerRule func(e *Expr, ctx *OptimizeContext) *Expr
OptimizerRule is an optimizer rule: it takes an expression and returns the rewritten expression.
var RuleAnnotateTypes OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { return AnnotateTypes(e, AnnotateOptions{Schema: ctx.Schema, Dialect: ctx.Dialect}) }
RuleAnnotateTypes mirrors the `annotate_types` rule: it receives schema and dialect.
var RuleCanonicalize OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { return Canonicalize(e, ctx.Dialect) }
RuleCanonicalize mirrors the `canonicalize` rule: it receives the dialect.
var RuleEliminateCTEs OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { return EliminateCTEs(e) }
RuleEliminateCTEs mirrors the `eliminate_ctes` rule (it only takes the expression).
var RuleEliminateJoins OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { return EliminateJoins(e) }
RuleEliminateJoins mirrors the `eliminate_joins` rule (it only takes the expression).
var RuleEliminateSubqueries OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { return EliminateSubqueries(e) }
RuleEliminateSubqueries mirrors the `eliminate_subqueries` rule (it only takes the expression).
var RuleMergeSubqueries OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { leaveTablesIsolated, _ := optKwarg[bool](ctx, "leave_tables_isolated") return MergeSubqueries(e, leaveTablesIsolated) }
RuleMergeSubqueries mirrors the `merge_subqueries` rule (leave_tables_isolated from kwargs, default False).
var RuleNormalize OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { dnf, _ := optKwarg[bool](ctx, "dnf") maxDistance := 128 if v, ok := optKwarg[int](ctx, "max_distance"); ok { maxDistance = v } return NormalizeCNF(e, dnf, maxDistance) }
RuleNormalize mirrors the `normalize` rule (dnf and max_distance from kwargs, defaults False and 128).
var RuleOptimizeJoins OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { return OptimizeJoins(e) }
RuleOptimizeJoins mirrors the `optimize_joins` rule (it only takes the expression).
var RulePushdownPredicates OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { return PushdownPredicates(e, ctx.Dialect) }
RulePushdownPredicates mirrors the `pushdown_predicates` rule: it receives the dialect.
var RulePushdownProjections OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { removeUnusedSelections := true if v, ok := optKwarg[bool](ctx, "remove_unused_selections"); ok { removeUnusedSelections = v } return PushdownProjections(e, ctx.Schema, removeUnusedSelections, ctx.Dialect) }
RulePushdownProjections mirrors the `pushdown_projections` rule: it receives schema and dialect (remove_unused_selections from kwargs, default True).
var RuleQualify OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { o := DefaultQualifyOptions() o.Dialect = ctx.Dialect o.Db = ctx.Db o.Catalog = ctx.Catalog o.Schema = ctx.Schema o.SQL = ctx.SQL o.IsolateTables = true o.QuoteIdentifiers = false for key, dst := range map[string]*bool{ "expand_alias_refs": &o.ExpandAliasRefs, "expand_stars": &o.ExpandStars, "isolate_tables": &o.IsolateTables, "qualify_columns": &o.QualifyColumns, "allow_partial_qualification": &o.AllowPartialQualification, "validate_qualify_columns": &o.ValidateQualifyColumns, "quote_identifiers": &o.QuoteIdentifiers, "identify": &o.Identify, "canonicalize_table_aliases": &o.CanonicalizeTableAliases, } { if v, ok := optKwarg[bool](ctx, key); ok { *dst = v } } if v, ok := optKwarg[Tri](ctx, "infer_schema"); ok { o.InferSchema = v } else if v, ok := optKwarg[bool](ctx, "infer_schema"); ok { o.InferSchema = TriFalse if v { o.InferSchema = TriTrue } } if v, ok := optKwarg[func(*Expr)](ctx, "on_qualify"); ok { o.OnQualify = v } return Qualify(e, o) }
RuleQualify mirrors the `qualify` rule: qualify receives dialect, db, catalog, schema, sql, isolate_tables=True and quote_identifiers=False, plus any matching kwargs.
var RuleQuoteIdentifiers OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { identify := true if v, ok := optKwarg[bool](ctx, "identify"); ok { identify = v } return QuoteIdentifiers(e, ctx.Dialect, identify) }
RuleQuoteIdentifiers mirrors the `quote_identifiers` rule: it receives the dialect (identify from kwargs, default True; optimize's quote_identifiers=False is not one of its parameters).
var RuleSimplify OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { return Simplify(e, SimplifyOptions{Dialect: ctx.Dialect}) }
RuleSimplify mirrors the `simplify` rule: it receives the dialect.
var RuleUnnestSubqueries OptimizerRule = func(e *Expr, ctx *OptimizeContext) *Expr { return UnnestSubqueries(e) }
RuleUnnestSubqueries mirrors the `unnest_subqueries` rule (it only takes the expression).
type OptionsType ¶
OptionsType mirrors sqlglot.parser.OPTIONS_TYPE: keyword -> sequences of follow-up words.
type ParseError ¶
type ParseError struct {
Msg string
Errors []ParseErrorDetail
}
ParseError mirrors sqlglot.errors.ParseError.
func (*ParseError) Error ¶
func (e *ParseError) Error() string
type ParseErrorDetail ¶
type ParseErrorDetail struct {
Description string
Line int
Col int
StartContext string
Highlight string
EndContext string
IntoExpression string
}
ParseErrorDetail mirrors one entry of ParseError.errors.
type ParseOptions ¶
type ParseOptions struct {
ErrorLevel *ErrorLevel
ErrorMessageContext int
MaxErrors int
MaxNodes int
}
ParseOptions mirrors the parser keyword options.
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser mirrors sqlglot.parser.Parser.
type ParserData ¶
type ParserData struct {
ADD_CONSTRAINT_TOKENS TokenSet
ADD_JOIN_ON_TRUE bool
ADJACENT_STRINGS_CANNOT_BE_CONNECTED bool
AGGREGATE_TYPE_TOKENS TokenSet
AGG_FUNCTIONS StrSet
AGG_FUNCTIONS_SUFFIXES []string
ALIAS_TOKENS TokenSet
ALTERABLES TokenSet
ALTER_RENAME_REQUIRES_COLUMN bool
ALTER_TABLE_PARTITIONS bool
AMBIGUOUS_ALIAS_TOKENS []TokenType
ANALYZE_STYLES StrSet
ARG_MODE_TOKENS TokenSet
ARRAY_CONSTRUCTORS map[string]Kind
ASSIGNMENT map[TokenType]Kind
BITWISE map[TokenType]Kind
BRACKETS TokenSet
CAST_ACTIONS OptionsType
CAST_COLUMN_OPERATORS TokenSet
CHANGE_COLUMN_ALTER_SYNTAX bool
CLONE_KEYWORDS StrSet
COLON_CHAIN_IS_SINGLE_EXTRACT bool
COLON_IS_VARIANT_EXTRACT bool
COLON_PLACEHOLDER_TOKENS TokenSet
COLUMN_DEFINITION_MODES StrSet
COLUMN_POSTFIX_TOKENS TokenSet
COMMENT_TABLE_ALIAS_TOKENS TokenSet
COMPARISON map[TokenType]Kind
CONFLICT_ACTIONS OptionsType
CONJUNCTION map[TokenType]Kind
COPY_INTO_VARLEN_OPTIONS StrSet
CREATABLES TokenSet
CREATE_SEQUENCE OptionsType
DASHED_TABLE_PART_FOLLOW_TOKENS TokenSet
DB_CREATABLES TokenSet
DDL_SELECT_TOKENS TokenSet
DEFAULT_SAMPLING_METHOD string
DESCRIBE_STYLES StrSet
DISJUNCTION map[TokenType]Kind
DISTINCT_TOKENS TokenSet
ENUM_TYPE_TOKENS TokenSet
EQUALITY map[TokenType]Kind
EXECUTE_AS_OPTIONS OptionsType
EXPONENT map[TokenType]Kind
FACTOR map[TokenType]Kind
FETCH_TOKENS TokenSet
FLATTEN_COLUMNS []string
FUNCTIONS_WITH_ALIASED_ARGS StrSet
FUNC_TOKENS TokenSet
HISTORICAL_DATA_KIND StrSet
HISTORICAL_DATA_PREFIX StrSet
IDENTIFIER_TOKENS TokenSet
IDENTIFY_PIVOT_STRINGS bool
ID_VAR_TOKENS TokenSet
INSERT_ALTERNATIVES StrSet
INTERVAL_SPANS bool
INVALID_FUNC_NAME_TOKENS TokenSet
ISOLATED_LOADING_OPTIONS OptionsType
IS_JSON_PREDICATE_KIND StrSet
JOINS_HAVE_EQUAL_PRECEDENCE bool
JOIN_HINTS StrSet
JOIN_KINDS TokenSet
JOIN_METHODS TokenSet
JOIN_SIDES TokenSet
JSON_ARROWS_REQUIRE_JSON_TYPE bool
JSON_EXTRACT_REQUIRES_JSON_EXPRESSION bool
JSON_KEY_VALUE_SEPARATOR_TOKENS TokenSet
JSON_QUERY_OPTIONS OptionsType
KEY_CONSTRAINT_OPTIONS OptionsType
KEY_VALUE_DEFINITIONS []Kind
LAMBDA_ARG_TERMINATORS TokenSet
LOG_DEFAULTS_TO_LN bool
MAP_KEYS_ARE_ARBITRARY_EXPRESSIONS bool
MODIFIABLES []Kind
MODIFIERS_ATTACHED_TO_SET_OP bool
NESTED_TYPE_TOKENS TokenSet
NON_TABLE_CREATABLES StrSet
NO_PAREN_FUNCTIONS map[TokenType]Kind
NO_PAREN_IF_COMMANDS bool
ODBC_DATETIME_LITERALS map[string]Kind
ON_CONDITION_TOKENS StrSet
OPCLASS_FOLLOW_KEYWORDS StrSet
OPERATION_MODIFIERS StrSet
OPTIONAL_ALIAS_TOKEN_CTE bool
OPTYPE_FOLLOW_TOKENS TokenSet
PARTITION_KEYWORDS StrSet
PIVOT_COLUMN_NAMING string
PREFIXED_PIVOT_COLUMNS bool
PRE_VOLATILE_TOKENS TokenSet
PRIVILEGE_FOLLOW_TOKENS TokenSet
PROCEDURE_OPTIONS OptionsType
PROFILE_TYPES OptionsType
QUERY_MODIFIER_TOKENS TokenSet
QUERY_RESTRICTIONS OptionsType
RECURSIVE_CTE_SEARCH_KIND StrSet
RESERVED_TOKENS TokenSet
RETURNS_TABLE_TOKENS TokenSet
SCHEMA_BINDING_OPTIONS OptionsType
SCHEMA_KINDS StrSet
SCHEMA_UNNAMED_CONSTRAINTS StrSet
SECURITY_PROPERTY_KEYWORDS StrSet
SELECT_START_TOKENS TokenSet
SET_ASSIGNMENT_DELIMITERS StrSet
SET_OPERATIONS TokenSet
SET_OP_MODIFIERS StrSet
SET_REQUIRES_ASSIGNMENT_DELIMITER bool
SIGNED_TO_UNSIGNED_TYPE_TOKEN map[TokenType]TokenType
STAGED_FILE_SINGLE_TOKENS TokenSet
STRICT_CAST bool
STRING_ALIASES bool
STRUCT_TYPE_TOKENS TokenSet
SUBQUERY_PREDICATES map[TokenType]Kind
SUBQUERY_TOKENS TokenSet
SUPPORTS_IMPLICIT_UNNEST bool
SUPPORTS_OMITTED_INTERVAL_SPAN_UNIT bool
SUPPORTS_PARTITION_SELECTION bool
TABLESAMPLE_CSV bool
TABLE_ALIAS_TOKENS TokenSet
TABLE_INDEX_HINT_TOKENS TokenSet
TABLE_POSTFIX_TOKENS TokenSet
TABLE_TERMINATORS TokenSet
TERM map[TokenType]Kind
TEXT_MATCH_EXCLUDED_TOKENS TokenSet
TIMES TokenSet
TIMESTAMPS TokenSet
TRANSACTION_CHARACTERISTICS OptionsType
TRANSACTION_KIND StrSet
TRIGGER_DEFERRABLE OptionsType
TRIGGER_EVENTS TokenSet
TRIGGER_TIMING OptionsType
TRIM_PATTERN_FIRST bool
TRIM_TYPES StrSet
TYPED_LAMBDA_ARGS bool
TYPE_TOKENS TokenSet
UNDROP_OBJECTS OptionsType
UNNEST_OFFSET_ALIAS_TOKENS TokenSet
UPDATE_ALIAS_TOKENS TokenSet
USABLES OptionsType
VALUES_FOLLOWED_BY_PAREN bool
VIEW_ATTRIBUTES StrSet
WINDOW_ALIAS_TOKENS TokenSet
WINDOW_BEFORE_PAREN_TOKENS TokenSet
WINDOW_EXCLUDE_OPTIONS OptionsType
WINDOW_SIDES StrSet
WRAPPED_TRANSFORM_COLUMN_CONSTRAINT bool
ZONE_AWARE_TIMESTAMP_CONSTRUCTOR bool
}
type ParserSettings ¶
type ParserSettings struct {
*ParserData
FUNCTIONS map[string]FuncBuilder
LAMBDAS map[TokenType]lambdaParseFn
COLUMN_OPERATORS map[TokenType]columnOperatorFn
EXPRESSION_PARSERS map[Kind]parseFn
STATEMENT_PARSERS map[TokenType]parseFn
UNARY_PARSERS map[TokenType]parseFn
STRING_PARSERS map[TokenType]tokenParseFn
NUMERIC_PARSERS map[TokenType]tokenParseFn
PRIMARY_PARSERS map[TokenType]tokenParseFn
PLACEHOLDER_PARSERS map[TokenType]parseFn
RANGE_PARSERS map[TokenType]rangeParseFn
PIPE_SYNTAX_TRANSFORM_PARSERS map[string]pipeTransformFn
PROPERTY_PARSERS map[string]propertyParseFn
CONSTRAINT_PARSERS map[string]parseFn
ALTER_PARSERS map[string]parseAnyFn
ALTER_ALTER_PARSERS map[string]parseFn
NO_PAREN_FUNCTION_PARSERS map[string]parseFn
FUNCTION_PARSERS map[string]parseFn
QUERY_MODIFIER_PARSERS map[TokenType]queryModifierFn
SET_PARSERS map[string]parseFn
SHOW_PARSERS map[string]parseFn
TYPE_LITERAL_PARSERS map[DType]typeLiteralParseFn
TYPE_CONVERTERS map[DType]typeConverterFn
ANALYZE_EXPRESSION_PARSERS map[string]parseFn
DESCRIBE_QUALIFIER_PARSERS map[string]parseFn
SHOW_TRIE *trie
SET_TRIE *trie
// contains filtered or unexported fields
}
ParserSettings is the fully-resolved parser configuration of a dialect.
type QualifyOptions ¶
type QualifyOptions struct {
Dialect *Dialect
// Db and Catalog are the default database/catalog names ("" means None).
Db string
Catalog string
Schema *MappingSchema
ExpandAliasRefs bool
ExpandStars bool
// InferSchema mirrors `infer_schema: bool | None` (TriNone = None).
InferSchema Tri
IsolateTables bool
QualifyColumns bool
AllowPartialQualification bool
ValidateQualifyColumns bool
QuoteIdentifiers bool
Identify bool
CanonicalizeTableAliases bool
// OnQualify is called after a table has been qualified (may be nil).
OnQualify func(table *Expr)
// SQL is the original SQL string for error highlighting ("" means None).
SQL string
// Defaults applies the Python defaults described above.
Defaults bool
}
QualifyOptions mirrors the keyword arguments of sqlglot.optimizer.qualify.qualify.
Go booleans cannot express "not passed", so:
- DefaultQualifyOptions() returns the Python defaults for every option.
- Defaults: true forces the options whose Python default is True and that callers normally leave alone (ExpandAliasRefs, ExpandStars, QualifyColumns, QuoteIdentifiers) to true. ValidateQualifyColumns and Identify are always taken as given (pass true to get the Python default), and options whose Python default is False/None are taken as given.
lineage.go relies on the latter: Qualify(e, QualifyOptions{..., ValidateQualifyColumns: false, Identify: false, Defaults: true}) mirrors qualify(e, dialect=..., schema=..., validate_qualify_columns=False, identify=False).
func DefaultQualifyOptions ¶
func DefaultQualifyOptions() QualifyOptions
DefaultQualifyOptions returns the Python default values of qualify's keyword arguments.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver mirrors sqlglot.optimizer.resolver.Resolver: a helper for resolving columns.
func NewResolver ¶
func NewResolver(scope *Scope, schema *MappingSchema, inferSchema bool) *Resolver
NewResolver mirrors Resolver(scope, schema, infer_schema).
func (*Resolver) AllColumns ¶
AllColumns mirrors Resolver.all_columns: all available columns of all sources in this scope.
func (*Resolver) GetSourceColumns ¶
GetSourceColumns mirrors Resolver.get_source_columns(name, only_visible).
func (*Resolver) GetSourceColumnsFromSetOp ¶
GetSourceColumnsFromSetOp mirrors Resolver.get_source_columns_from_set_op.
func (*Resolver) GetTableByName ¶
GetTableByName mirrors Resolver.get_table(column_name) for a string.
type SchemaError ¶
type SchemaError struct{ Msg string }
SchemaError mirrors sqlglot.errors.SchemaError.
func (*SchemaError) Error ¶
func (e *SchemaError) Error() string
type SchemaMap ¶
type SchemaMap = omap[any]
SchemaMap is a nested, ordered schema mapping.
func NewSchemaMapSize ¶
NewSchemaMapSize creates an empty schema mapping with room for n entries.
type Scope ¶
type Scope struct {
Expression *Expr
Sources *omap[Source]
LateralSources *omap[Source]
CTESources *omap[Source]
OuterColumns []string
Parent *Scope
SubqueryScopes []*Scope
DerivedTableScopes []*Scope
TableScopes []*Scope
CTEScopes []*Scope
UnionScopes []*Scope
UDTFScopes []*Scope
Type ScopeType
// contains filtered or unexported fields
}
Scope mirrors sqlglot.optimizer.scope.Scope.
func BuildScope ¶
BuildScope mirrors sqlglot.optimizer.scope.build_scope.
func NewScope ¶
func NewScope(expression *Expr, sources *omap[Source], outerColumns []string, parent *Scope, scopeType ScopeType, lateralSources, cteSources *omap[Source], canBeCorrelated bool, ) *Scope
NewScope mirrors Scope(expression, sources, outer_columns, parent, scope_type, lateral_sources, cte_sources, can_be_correlated).
func TraverseScope ¶
TraverseScope mirrors sqlglot.optimizer.scope.traverse_scope.
Python's _traverse_scope is a generator that traverse_scope fully consumes into a list; the port appends to that list directly. The bookkeeping Python runs after each yielded child scope (remembering the last child, registering it as a source) is done in the same order once the child traversal returns: none of the child traversals read that state (branches copy their source maps), so the result is identical.
func (*Scope) Branch ¶
func (s *Scope) Branch(expression *Expr, scopeType ScopeType, sources, cteSources, lateralSources *omap[Source], outerColumns []string) *Scope
Branch mirrors Scope.branch.
func (*Scope) ColumnIndex ¶
ColumnIndex mirrors Scope.column_index (object identity set of the collected Column nodes). It is rarely needed, so it is built on first use from the collected columns and column stars.
func (*Scope) DerivedTables ¶
DerivedTables mirrors Scope.derived_tables.
func (*Scope) ExternalColumns ¶
ExternalColumns mirrors Scope.external_columns.
func (*Scope) IsCorrelatedSubquery ¶
IsCorrelatedSubquery mirrors Scope.is_correlated_subquery.
func (*Scope) IsDerivedTable ¶
func (*Scope) IsSubquery ¶
func (*Scope) LocalColumns ¶
LocalColumns mirrors Scope.local_columns.
func (*Scope) RefCount ¶
RefCount mirrors Scope.ref_count, keyed by source identity (*Scope or *Expr).
func (*Scope) References ¶
func (s *Scope) References() []scopeRef
References mirrors Scope.references.
func (*Scope) RemoveSource ¶
RemoveSource mirrors Scope.remove_source.
func (*Scope) RenameSource ¶
RenameSource mirrors Scope.rename_source.
func (*Scope) ScansAllSubscopeColumns ¶
ScansAllSubscopeColumns mirrors Scope.scans_all_subscope_columns.
func (*Scope) SelectedSources ¶
func (s *Scope) SelectedSources() *omap[SelectedSource]
SelectedSources mirrors Scope.selected_sources.
func (*Scope) SemiOrAntiJoinTables ¶
SemiOrAntiJoinTables mirrors Scope.semi_or_anti_join_tables.
func (*Scope) SourceColumns ¶
SourceColumns mirrors Scope.source_columns.
func (*Scope) Subqueries ¶
Subqueries mirrors Scope.subqueries.
func (*Scope) TableColumns ¶
TableColumns mirrors Scope.table_columns.
func (*Scope) UnqualifiedColumns ¶
UnqualifiedColumns mirrors Scope.unqualified_columns.
type SelectedSource ¶
SelectedSource is a value of Scope.selected_sources: (node, source).
type Simplifier ¶
type Simplifier struct {
// contains filtered or unexported fields
}
Simplifier mirrors sqlglot.optimizer.simplify.Simplifier.
func NewSimplifier ¶
func NewSimplifier(d *Dialect, annotateNewExpressions bool) *Simplifier
NewSimplifier mirrors Simplifier(dialect=d, annotate_new_expressions=...). d == nil means the default dialect.
func (*Simplifier) AbsorbAndEliminate ¶
func (s *Simplifier) AbsorbAndEliminate(expression *Expr, root bool) *Expr
AbsorbAndEliminate mirrors Simplifier.absorb_and_eliminate:
absorption:
A AND (A OR B) -> A
A OR (A AND B) -> A
A AND (NOT A OR B) -> A AND B
A OR (NOT A AND B) -> A OR B
elimination:
(A AND B) OR (A AND NOT B) -> A
(A OR B) AND (A OR NOT B) -> A
func (*Simplifier) Dialect ¶
func (s *Simplifier) Dialect() *Dialect
Dialect returns the Simplifier's dialect.
func (*Simplifier) RemoveComplements ¶
func (s *Simplifier) RemoveComplements(expression *Expr, root bool) *Expr
RemoveComplements mirrors Simplifier.remove_complements:
A AND NOT A -> FALSE (only for non-NULL A) A OR NOT A -> TRUE (only for non-NULL A)
func (*Simplifier) RewriteBetween ¶
func (s *Simplifier) RewriteBetween(expression *Expr) *Expr
RewriteBetween mirrors Simplifier.rewrite_between: rewrite x between y and z to x >= y AND x <= z. This is done because comparison simplification is only done on lt/lte/gt/gte.
func (*Simplifier) Simplify ¶
func (s *Simplifier) Simplify(expression *Expr, constantPropagation, coalesceSimplification bool) *Expr
Simplify mirrors Simplifier.simplify.
func (*Simplifier) SimplifyCoalesce ¶
func (s *Simplifier) SimplifyCoalesce(expression *Expr) *Expr
SimplifyCoalesce mirrors Simplifier.simplify_coalesce.
func (*Simplifier) SimplifyComparison ¶
func (s *Simplifier) SimplifyComparison(expression, left, right *Expr, or bool) *Expr
SimplifyComparison mirrors Simplifier._simplify_comparison.
func (*Simplifier) SimplifyConcat ¶
func (s *Simplifier) SimplifyConcat(expression *Expr) *Expr
SimplifyConcat mirrors Simplifier.simplify_concat: reduces all groups that contain string literals by concatenating them.
func (*Simplifier) SimplifyConditionals ¶
func (s *Simplifier) SimplifyConditionals(expression *Expr) *Expr
SimplifyConditionals mirrors Simplifier.simplify_conditionals: simplifies expressions like IF, CASE if their condition is statically known.
func (*Simplifier) SimplifyConnectors ¶
func (s *Simplifier) SimplifyConnectors(expression *Expr, root bool) *Expr
SimplifyConnectors mirrors Simplifier.simplify_connectors.
func (*Simplifier) SimplifyDatetrunc ¶
func (s *Simplifier) SimplifyDatetrunc(expression *Expr) *Expr
SimplifyDatetrunc mirrors Simplifier.simplify_datetrunc: simplify expressions like `DATE_TRUNC('year', x) >= CAST('2021-01-01' AS DATE)`.
func (*Simplifier) SimplifyEquality ¶
func (s *Simplifier) SimplifyEquality(expression *Expr) *Expr
SimplifyEquality mirrors Simplifier.simplify_equality: use the subtraction and addition properties of equality to simplify expressions:
x + 1 = 3 becomes x = 2
Subtraction is not commutative, so when the variable is the subtrahend the operands can't simply be swapped; the comparison is inverted instead:
5 - x = 2 becomes x = 3 5 - x < 2 becomes x > 3
func (*Simplifier) SimplifyLiterals ¶
func (s *Simplifier) SimplifyLiterals(expression *Expr, root bool) *Expr
SimplifyLiterals mirrors Simplifier.simplify_literals.
func (*Simplifier) SimplifyNot ¶
func (s *Simplifier) SimplifyNot(expression *Expr) *Expr
SimplifyNot mirrors Simplifier.simplify_not (Demorgan's Law):
NOT (x OR y) -> NOT x AND NOT y NOT (x AND y) -> NOT x OR NOT y
func (*Simplifier) SimplifyStartswith ¶
func (s *Simplifier) SimplifyStartswith(expression *Expr) *Expr
SimplifyStartswith mirrors Simplifier.simplify_startswith: reduces a prefix check to either TRUE or FALSE if both the string and the prefix are statically known.
func (*Simplifier) SortComparison ¶
func (s *Simplifier) SortComparison(expression *Expr) *Expr
SortComparison mirrors Simplifier.sort_comparison.
type SimplifyOptions ¶
type SimplifyOptions struct {
// ConstantPropagation mirrors constant_propagation.
ConstantPropagation bool
// Coalesce mirrors coalesce_simplification.
Coalesce bool
// Dialect mirrors dialect (nil means the default dialect).
Dialect *Dialect
// MaxDepth is accepted for API compatibility only: sqlglot 30.13's simplify has no max_depth
// parameter, so it is ignored.
MaxDepth int
}
SimplifyOptions mirrors the keyword arguments of sqlglot.optimizer.simplify.simplify.
type StrSet ¶
type StrSet map[string]struct{}
StrSet is a set of strings.
func ColumnTableNames ¶
ColumnTableNames mirrors exp.column_table_names.
type Token ¶
type Token struct {
Type TokenType
Line int32
Col int32
Start int32
End int32
Text string
Comments []string
}
Token mirrors sqlglot.tokens.Token. Positions are in Unicode code points, like Python.
type TokenError ¶
type TokenError struct{ Msg string }
TokenError mirrors sqlglot.errors.TokenError.
func (*TokenError) Error ¶
func (e *TokenError) Error() string
type TokenSet ¶
type TokenSet struct {
// contains filtered or unexported fields
}
TokenSet is an immutable-by-convention bitset of token types.
type TokenType ¶
type TokenType uint16
TokenType mirrors sqlglot.tokens.TokenType.
const ( TK_NONE TokenType = 0 TK_L_PAREN TokenType = 1 TK_R_PAREN TokenType = 2 TK_L_BRACKET TokenType = 3 TK_R_BRACKET TokenType = 4 TK_L_BRACE TokenType = 5 TK_R_BRACE TokenType = 6 TK_COMMA TokenType = 7 TK_DOT TokenType = 8 TK_DASH TokenType = 9 TK_PLUS TokenType = 10 TK_COLON TokenType = 11 TK_DOTCOLON TokenType = 12 TK_DOTCARET TokenType = 13 TK_DCOLON TokenType = 14 TK_DCOLONDOLLAR TokenType = 15 TK_DCOLONPERCENT TokenType = 16 TK_DCOLONQMARK TokenType = 17 TK_DQMARK TokenType = 18 TK_SEMICOLON TokenType = 19 TK_STAR TokenType = 20 TK_BACKSLASH TokenType = 21 TK_SLASH TokenType = 22 TK_LT TokenType = 23 TK_LTE TokenType = 24 TK_GT TokenType = 25 TK_GTE TokenType = 26 TK_NOT TokenType = 27 TK_EQ TokenType = 28 TK_NEQ TokenType = 29 TK_NULLSAFE_EQ TokenType = 30 TK_COLON_EQ TokenType = 31 TK_COLON_GT TokenType = 32 TK_NCOLON_GT TokenType = 33 TK_AND TokenType = 34 TK_OR TokenType = 35 TK_AMP TokenType = 36 TK_DPIPE TokenType = 37 TK_PIPE_GT TokenType = 38 TK_PIPE TokenType = 39 TK_PIPE_SLASH TokenType = 40 TK_DPIPE_SLASH TokenType = 41 TK_CARET TokenType = 42 TK_CARET_AT TokenType = 43 TK_TILDE TokenType = 44 TK_ARROW TokenType = 45 TK_DARROW TokenType = 46 TK_FARROW TokenType = 47 TK_HASH TokenType = 48 TK_HASH_ARROW TokenType = 49 TK_DHASH_ARROW TokenType = 50 TK_LR_ARROW TokenType = 51 TK_LLRR_ARROW TokenType = 52 TK_DAT TokenType = 53 TK_AT_QMARK TokenType = 54 TK_LT_AT TokenType = 55 TK_AT_GT TokenType = 56 TK_DOLLAR TokenType = 57 TK_PARAMETER TokenType = 58 TK_SESSION TokenType = 59 TK_SESSION_PARAMETER TokenType = 60 TK_SESSION_USER TokenType = 61 TK_DAMP TokenType = 62 TK_AMP_LT TokenType = 63 TK_AMP_GT TokenType = 64 TK_ADJACENT TokenType = 65 TK_XOR TokenType = 66 TK_DSTAR TokenType = 67 TK_QMARK_AMP TokenType = 68 TK_QMARK_PIPE TokenType = 69 TK_HASH_DASH TokenType = 70 TK_EXCLAMATION TokenType = 71 TK_URI_START TokenType = 72 TK_BLOCK_START TokenType = 73 TK_BLOCK_END TokenType = 74 TK_SPACE TokenType = 75 TK_BREAK TokenType = 76 TK_STRING TokenType = 77 TK_NUMBER TokenType = 78 TK_IDENTIFIER TokenType = 79 TK_DATABASE TokenType = 80 TK_COLUMN TokenType = 81 TK_COLUMN_DEF TokenType = 82 TK_SCHEMA TokenType = 83 TK_TABLE TokenType = 84 TK_WAREHOUSE TokenType = 85 TK_STAGE TokenType = 86 TK_STREAM TokenType = 87 TK_STREAMLIT TokenType = 88 TK_VAR TokenType = 89 TK_BIT_STRING TokenType = 90 TK_HEX_STRING TokenType = 91 TK_BYTE_STRING TokenType = 92 TK_NATIONAL_STRING TokenType = 93 TK_RAW_STRING TokenType = 94 TK_HEREDOC_STRING TokenType = 95 TK_UNICODE_STRING TokenType = 96 TK_BIT TokenType = 97 TK_BOOLEAN TokenType = 98 TK_TINYINT TokenType = 99 TK_UTINYINT TokenType = 100 TK_SMALLINT TokenType = 101 TK_USMALLINT TokenType = 102 TK_MEDIUMINT TokenType = 103 TK_UMEDIUMINT TokenType = 104 TK_INT TokenType = 105 TK_UINT TokenType = 106 TK_BIGINT TokenType = 107 TK_UBIGINT TokenType = 108 TK_BIGNUM TokenType = 109 TK_INT128 TokenType = 110 TK_UINT128 TokenType = 111 TK_INT256 TokenType = 112 TK_UINT256 TokenType = 113 TK_FLOAT TokenType = 114 TK_DOUBLE TokenType = 115 TK_UDOUBLE TokenType = 116 TK_DECIMAL TokenType = 117 TK_DECIMAL32 TokenType = 118 TK_DECIMAL64 TokenType = 119 TK_DECIMAL128 TokenType = 120 TK_DECIMAL256 TokenType = 121 TK_DECFLOAT TokenType = 122 TK_UDECIMAL TokenType = 123 TK_BIGDECIMAL TokenType = 124 TK_CHAR TokenType = 125 TK_NCHAR TokenType = 126 TK_VARCHAR TokenType = 127 TK_NVARCHAR TokenType = 128 TK_BPCHAR TokenType = 129 TK_TEXT TokenType = 130 TK_MEDIUMTEXT TokenType = 131 TK_LONGTEXT TokenType = 132 TK_BLOB TokenType = 133 TK_MEDIUMBLOB TokenType = 134 TK_LONGBLOB TokenType = 135 TK_TINYBLOB TokenType = 136 TK_TINYTEXT TokenType = 137 TK_NAME TokenType = 138 TK_BINARY TokenType = 139 TK_VARBINARY TokenType = 140 TK_JSON TokenType = 141 TK_JSONB TokenType = 142 TK_TIME TokenType = 143 TK_TIMETZ TokenType = 144 TK_TIME_NS TokenType = 145 TK_TIMESTAMP TokenType = 146 TK_TIMESTAMPTZ TokenType = 147 TK_TIMESTAMPLTZ TokenType = 148 TK_TIMESTAMPNTZ TokenType = 149 TK_TIMESTAMP_S TokenType = 150 TK_TIMESTAMP_MS TokenType = 151 TK_TIMESTAMP_NS TokenType = 152 TK_DATETIME TokenType = 153 TK_DATETIME2 TokenType = 154 TK_DATETIME64 TokenType = 155 TK_SMALLDATETIME TokenType = 156 TK_DATE TokenType = 157 TK_DATE32 TokenType = 158 TK_INT4RANGE TokenType = 159 TK_INT4MULTIRANGE TokenType = 160 TK_INT8RANGE TokenType = 161 TK_INT8MULTIRANGE TokenType = 162 TK_NUMRANGE TokenType = 163 TK_NUMMULTIRANGE TokenType = 164 TK_TSRANGE TokenType = 165 TK_TSMULTIRANGE TokenType = 166 TK_TSTZRANGE TokenType = 167 TK_TSTZMULTIRANGE TokenType = 168 TK_DATERANGE TokenType = 169 TK_DATEMULTIRANGE TokenType = 170 TK_UUID TokenType = 171 TK_GEOGRAPHY TokenType = 172 TK_GEOGRAPHYPOINT TokenType = 173 TK_NULLABLE TokenType = 174 TK_GEOMETRY TokenType = 175 TK_POINT TokenType = 176 TK_RING TokenType = 177 TK_LINESTRING TokenType = 178 TK_LOCALTIME TokenType = 179 TK_LOCALTIMESTAMP TokenType = 180 TK_SYSTIMESTAMP TokenType = 181 TK_MULTILINESTRING TokenType = 182 TK_POLYGON TokenType = 183 TK_MULTIPOLYGON TokenType = 184 TK_HLLSKETCH TokenType = 185 TK_HSTORE TokenType = 186 TK_SUPER TokenType = 187 TK_SERIAL TokenType = 188 TK_SMALLSERIAL TokenType = 189 TK_BIGSERIAL TokenType = 190 TK_XML TokenType = 191 TK_YEAR TokenType = 192 TK_USERDEFINED TokenType = 193 TK_MONEY TokenType = 194 TK_SMALLMONEY TokenType = 195 TK_ROWVERSION TokenType = 196 TK_IMAGE TokenType = 197 TK_VARIANT TokenType = 198 TK_OBJECT TokenType = 199 TK_INET TokenType = 200 TK_IPADDRESS TokenType = 201 TK_IPPREFIX TokenType = 202 TK_IPV4 TokenType = 203 TK_IPV6 TokenType = 204 TK_ENUM TokenType = 205 TK_ENUM8 TokenType = 206 TK_ENUM16 TokenType = 207 TK_FIXEDSTRING TokenType = 208 TK_LOWCARDINALITY TokenType = 209 TK_NESTED TokenType = 210 TK_AGGREGATEFUNCTION TokenType = 211 TK_SIMPLEAGGREGATEFUNCTION TokenType = 212 TK_TDIGEST TokenType = 213 TK_UNKNOWN TokenType = 214 TK_VECTOR TokenType = 215 TK_DYNAMIC TokenType = 216 TK_VOID TokenType = 217 TK_ALIAS TokenType = 218 TK_ALTER TokenType = 219 TK_ALL TokenType = 220 TK_ANTI TokenType = 221 TK_ANY TokenType = 222 TK_APPLY TokenType = 223 TK_ARRAY TokenType = 224 TK_ASC TokenType = 225 TK_ASOF TokenType = 226 TK_ATTACH TokenType = 227 TK_AUTO_INCREMENT TokenType = 228 TK_BEGIN TokenType = 229 TK_BETWEEN TokenType = 230 TK_BULK_COLLECT_INTO TokenType = 231 TK_CACHE TokenType = 232 TK_CASE TokenType = 233 TK_CHARACTER_SET TokenType = 234 TK_CLUSTER_BY TokenType = 235 TK_COLLATE TokenType = 236 TK_COMMAND TokenType = 237 TK_COMMENT TokenType = 238 TK_COMMIT TokenType = 239 TK_CONNECT_BY TokenType = 240 TK_CONSTRAINT TokenType = 241 TK_COPY TokenType = 242 TK_CREATE TokenType = 243 TK_CROSS TokenType = 244 TK_CUBE TokenType = 245 TK_CURRENT_DATE TokenType = 246 TK_CURRENT_DATETIME TokenType = 247 TK_CURRENT_SCHEMA TokenType = 248 TK_CURRENT_TIME TokenType = 249 TK_CURRENT_TIMESTAMP TokenType = 250 TK_CURRENT_USER TokenType = 251 TK_CURRENT_USER_ID TokenType = 252 TK_CURRENT_ROLE TokenType = 253 TK_CURRENT_CATALOG TokenType = 254 TK_DECLARE TokenType = 255 TK_DEFAULT TokenType = 256 TK_DELETE TokenType = 257 TK_DESC TokenType = 258 TK_DESCRIBE TokenType = 259 TK_DETACH TokenType = 260 TK_DICTIONARY TokenType = 261 TK_DISTINCT TokenType = 262 TK_DISTRIBUTE_BY TokenType = 263 TK_DIV TokenType = 264 TK_DROP TokenType = 265 TK_ELSE TokenType = 266 TK_END TokenType = 267 TK_ESCAPE TokenType = 268 TK_EXCEPT TokenType = 269 TK_EXECUTE TokenType = 270 TK_EXISTS TokenType = 271 TK_FALSE TokenType = 272 TK_FETCH TokenType = 273 TK_FILE TokenType = 274 TK_FILE_FORMAT TokenType = 275 TK_FILTER TokenType = 276 TK_FINAL TokenType = 277 TK_FIRST TokenType = 278 TK_FOR TokenType = 279 TK_FORCE TokenType = 280 TK_FOREIGN_KEY TokenType = 281 TK_FORMAT TokenType = 282 TK_FROM TokenType = 283 TK_FULL TokenType = 284 TK_FUNCTION TokenType = 285 TK_GET TokenType = 286 TK_GLOB TokenType = 287 TK_GLOBAL TokenType = 288 TK_GRANT TokenType = 289 TK_GROUP_BY TokenType = 290 TK_GROUPING_SETS TokenType = 291 TK_HAVING TokenType = 292 TK_HINT TokenType = 293 TK_IGNORE TokenType = 294 TK_ILIKE TokenType = 295 TK_IN TokenType = 296 TK_INDEX TokenType = 297 TK_INDEXED_BY TokenType = 298 TK_INNER TokenType = 299 TK_INSERT TokenType = 300 TK_INSTALL TokenType = 301 TK_INTEGRATION TokenType = 302 TK_INTERSECT TokenType = 303 TK_INTERVAL TokenType = 304 TK_INTO TokenType = 305 TK_INTRODUCER TokenType = 306 TK_IRLIKE TokenType = 307 TK_IS TokenType = 308 TK_ISNULL TokenType = 309 TK_JOIN TokenType = 310 TK_JOIN_MARKER TokenType = 311 TK_KEEP TokenType = 312 TK_KEY TokenType = 313 TK_KILL TokenType = 314 TK_LANGUAGE TokenType = 315 TK_LATERAL TokenType = 316 TK_LEFT TokenType = 317 TK_LIKE TokenType = 318 TK_LIMIT TokenType = 319 TK_LIST TokenType = 320 TK_LOAD TokenType = 321 TK_LOCK TokenType = 322 TK_MAP TokenType = 323 TK_MATCH TokenType = 324 TK_MATCH_CONDITION TokenType = 325 TK_MATCH_RECOGNIZE TokenType = 326 TK_MEMBER_OF TokenType = 327 TK_MERGE TokenType = 328 TK_MOD TokenType = 329 TK_MODEL TokenType = 330 TK_NATURAL TokenType = 331 TK_NEXT TokenType = 332 TK_NOTHING TokenType = 333 TK_NOTNULL TokenType = 334 TK_NULL TokenType = 335 TK_OBJECT_IDENTIFIER TokenType = 336 TK_OFFSET TokenType = 337 TK_ON TokenType = 338 TK_ONLY TokenType = 339 TK_OPERATOR TokenType = 340 TK_ORDER_BY TokenType = 341 TK_ORDER_SIBLINGS_BY TokenType = 342 TK_ORDERED TokenType = 343 TK_ORDINALITY TokenType = 344 TK_OUT TokenType = 345 TK_INOUT TokenType = 346 TK_OUTER TokenType = 347 TK_OVER TokenType = 348 TK_OVERLAPS TokenType = 349 TK_OVERWRITE TokenType = 350 TK_PACKAGE TokenType = 351 TK_PARTITION TokenType = 352 TK_PARTITION_BY TokenType = 353 TK_PERCENT TokenType = 354 TK_PIVOT TokenType = 355 TK_PLACEHOLDER TokenType = 356 TK_POLICY TokenType = 357 TK_POOL TokenType = 358 TK_POSITIONAL TokenType = 359 TK_PRAGMA TokenType = 360 TK_PREWHERE TokenType = 361 TK_PRIMARY_KEY TokenType = 362 TK_PROCEDURE TokenType = 363 TK_PROPERTIES TokenType = 364 TK_PROJECTION TokenType = 365 TK_PSEUDO_TYPE TokenType = 366 TK_PUT TokenType = 367 TK_QUALIFY TokenType = 368 TK_QUOTE TokenType = 369 TK_QDCOLON TokenType = 370 TK_RANGE TokenType = 371 TK_RECURSIVE TokenType = 372 TK_REFRESH TokenType = 373 TK_RENAME TokenType = 374 TK_REPLACE TokenType = 375 TK_RETURNING TokenType = 376 TK_REVOKE TokenType = 377 TK_REFERENCES TokenType = 378 TK_RIGHT TokenType = 379 TK_RLIKE TokenType = 380 TK_ROLE TokenType = 381 TK_ROLLBACK TokenType = 382 TK_ROLLUP TokenType = 383 TK_ROW TokenType = 384 TK_ROWS TokenType = 385 TK_RULE TokenType = 386 TK_SELECT TokenType = 387 TK_SEMI TokenType = 388 TK_SEPARATOR TokenType = 389 TK_SEQUENCE TokenType = 390 TK_SERDE_PROPERTIES TokenType = 391 TK_SET TokenType = 392 TK_SETTINGS TokenType = 393 TK_SHOW TokenType = 394 TK_SIMILAR_TO TokenType = 395 TK_SOME TokenType = 396 TK_SORT_BY TokenType = 397 TK_SOUNDS_LIKE TokenType = 398 TK_SQL_SECURITY TokenType = 399 TK_START_WITH TokenType = 400 TK_STORAGE_INTEGRATION TokenType = 401 TK_STRAIGHT_JOIN TokenType = 402 TK_STRUCT TokenType = 403 TK_SUMMARIZE TokenType = 404 TK_TABLE_SAMPLE TokenType = 405 TK_TAG TokenType = 406 TK_TEMPORARY TokenType = 407 TK_TOP TokenType = 408 TK_THEN TokenType = 409 TK_TRUE TokenType = 410 TK_TRUNCATE TokenType = 411 TK_TRIGGER TokenType = 412 TK_TYPE TokenType = 413 TK_UNCACHE TokenType = 414 TK_UNDROP TokenType = 415 TK_UNION TokenType = 416 TK_UNNEST TokenType = 417 TK_UNPIVOT TokenType = 418 TK_UPDATE TokenType = 419 TK_USE TokenType = 420 TK_USING TokenType = 421 TK_VALUES TokenType = 422 TK_VARIADIC TokenType = 423 TK_VIEW TokenType = 424 TK_SEMANTIC_VIEW TokenType = 425 TK_VOLATILE TokenType = 426 TK_VOLUME TokenType = 427 TK_WHEN TokenType = 428 TK_WHERE TokenType = 429 TK_WINDOW TokenType = 430 TK_WITH TokenType = 431 TK_UNIQUE TokenType = 432 TK_UTC_DATE TokenType = 433 TK_UTC_TIME TokenType = 434 TK_UTC_TIMESTAMP TokenType = 435 TK_VERSION_SNAPSHOT TokenType = 436 TK_TIMESTAMP_SNAPSHOT TokenType = 437 TK_OPTION TokenType = 438 TK_SINK TokenType = 439 TK_SOURCE TokenType = 440 TK_ANALYZE TokenType = 441 TK_NAMESPACE TokenType = 442 TK_EXPORT TokenType = 443 TK_HIVE_TOKEN_STREAM TokenType = 444 TK_SENTINEL TokenType = 445 )
type TokenizerSettings ¶
type TokenizerSettings struct {
BIT_STRINGS [][2]string
BYTE_STRINGS [][2]string
BYTE_STRING_ESCAPES []string
COMMANDS TokenSet
COMMAND_PREFIX_TOKENS TokenSet
COMMENTS [][2]string
ESCAPE_FOLLOW_CHARS []string
HEREDOC_STRINGS []string
HEREDOC_STRING_ALTERNATIVE TokenType
HEREDOC_TAG_IS_IDENTIFIER bool
HEX_STRINGS [][2]string
HINT_START string
IDENTIFIERS [][2]string
IDENTIFIER_ESCAPES []string
KEYWORDS map[string]TokenType
NESTED_COMMENTS bool
NUMBERS_CAN_HAVE_DECIMALS bool
NUMERIC_LITERALS map[string]string
QUOTES []string
RAW_STRINGS [][2]string
SINGLE_TOKENS map[string]TokenType
STRING_ESCAPES []string
STRING_ESCAPES_ALLOWED_IN_RAW_STRINGS bool
TOKENS_PRECEDING_HINT TokenSet
UNICODE_STRINGS [][2]string
VAR_SINGLE_TOKENS StrSet
// contains filtered or unexported fields
}
type TypeAnnotator ¶
type TypeAnnotator struct {
// contains filtered or unexported fields
}
TypeAnnotator mirrors sqlglot.optimizer.annotate_types.TypeAnnotator.
func (*TypeAnnotator) Annotate ¶
func (a *TypeAnnotator) Annotate(expression *Expr, annotateScope bool) *Expr
Annotate mirrors TypeAnnotator.annotate(expression, annotate_scope) (exported for the Simplifier's annotator interface).
func (*TypeAnnotator) Clear ¶
func (a *TypeAnnotator) Clear()
Clear mirrors TypeAnnotator.clear() (exported for the Simplifier's annotator interface).
func (*TypeAnnotator) Dialect ¶
func (a *TypeAnnotator) Dialect() *Dialect
Dialect returns the annotator's dialect.
func (*TypeAnnotator) Schema ¶
func (a *TypeAnnotator) Schema() *MappingSchema
Schema returns the annotator's schema.
type UnsupportedError ¶
type UnsupportedError struct{ Msg string }
UnsupportedError mirrors sqlglot.errors.UnsupportedError.
func (*UnsupportedError) Error ¶
func (e *UnsupportedError) Error() string
type ValueError ¶
type ValueError struct{ Msg string }
ValueError mirrors a Python ValueError raised by sqlglot.
func (*ValueError) Error ¶
func (e *ValueError) Error() string
Source Files
¶
- api.go
- athena_tokenizer.go
- builders.go
- d_athena.go
- d_bigquery.go
- d_bigquery_generator.go
- d_bigquery_parser.go
- d_clickhouse.go
- d_clickhouse_generator.go
- d_clickhouse_parser.go
- d_databricks.go
- d_doris.go
- d_duckdb.go
- d_duckdb_gen.go
- d_duckdb_gen2.go
- d_duckdb_gen_helpers.go
- d_duckdb_util.go
- d_fabric.go
- d_hive.go
- d_hive_generator.go
- d_mysql.go
- d_mysql_generator.go
- d_oracle.go
- d_postgres.go
- d_postgres_generator.go
- d_presto.go
- d_presto_generator.go
- d_redshift.go
- d_snowflake.go
- d_snowflake_generator.go
- d_snowflake_parser.go
- d_spark.go
- d_spark2.go
- d_sqlite.go
- d_starrocks.go
- d_trino.go
- d_tsql.go
- d_tsql_generator.go
- d_tsql_parser.go
- datatypes.go
- dialect.go
- dialect_helpers.go
- dialects.go
- doc.go
- errors.go
- expr.go
- expr_builders.go
- expr_props.go
- gen_ddl.go
- gen_exprs.go
- gen_funcs.go
- gen_funcs2.go
- gen_misc.go
- gen_ops.go
- gen_properties.go
- gen_query.go
- gen_select.go
- gen_table.go
- gen_tables.go
- generator.go
- generator_hooks.go
- jsonpath.go
- kind.go
- lineage.go
- omap.go
- opt_annotate.go
- opt_canonicalize.go
- opt_eliminate_ctes.go
- opt_eliminate_joins.go
- opt_eliminate_subqueries.go
- opt_isolate.go
- opt_merge.go
- opt_normalize.go
- opt_normalize_cnf.go
- opt_optimize_joins.go
- opt_optimizer.go
- opt_pushdown_predicates.go
- opt_pushdown_projections.go
- opt_qualify.go
- opt_qualify_columns.go
- opt_qualify_tables.go
- opt_resolver.go
- opt_simplify.go
- opt_simplify_dates.go
- opt_simplify_gen.go
- opt_simplify_num.go
- opt_simplify_rules.go
- opt_unnest.go
- parser.go
- parser_clauses.go
- parser_constraints.go
- parser_core.go
- parser_ddl.go
- parser_dml.go
- parser_expr.go
- parser_funcs.go
- parser_hooks.go
- parser_pipe.go
- parser_primary.go
- parser_properties.go
- parser_select.go
- parser_statements.go
- parser_table.go
- parser_tables.go
- ported_unused.go
- pystr.go
- schema.go
- scope.go
- sets.go
- time.go
- tokenizer.go
- transforms.go
- trie.go
- typing.go
- typing_bigquery.go
- typing_clickhouse.go
- typing_databricks.go
- typing_duckdb.go
- typing_hive.go
- typing_mysql.go
- typing_postgres.go
- typing_presto.go
- typing_redshift.go
- typing_snowflake.go
- typing_spark.go
- typing_spark2.go
- typing_tsql.go
- zz_dialect_settings.go
- zz_dtypes.go
- zz_exp_constants.go
- zz_generator_methods.go
- zz_generator_settings.go
- zz_kinds.go
- zz_parser_settings.go
- zz_props.go
- zz_tokenizer_settings.go
- zz_tokens.go
- zz_unicode.go