Expand description
SQL Expression AST (Abstract Syntax Tree).
This module defines all the AST node types used to represent parsed SQL statements and expressions. The design follows Python sqlglot’s expression hierarchy, ported to a Rust enum-based AST.
§Architecture
The central type is Expression, a large tagged enum with one variant per
SQL construct. Inner structs carry the fields for each variant. Most
heap-allocated variants are wrapped in Box to keep the enum size small.
§Variant Groups
| Group | Examples | Purpose |
|---|---|---|
| Queries | Select, Union, Intersect, Except, Subquery | Top-level query structures |
| DML | Insert, Update, Delete, Merge, Copy | Data manipulation |
| DDL | CreateTable, AlterTable, DropView, CreateIndex | Schema definition |
| Clauses | From, Join, Where, GroupBy, OrderBy, With | Query clauses |
| Operators | And, Or, Add, Eq, Like, Not | Binary and unary operations |
| Functions | Function, AggregateFunction, WindowFunction, Count, Sum | Scalar, aggregate, and window functions |
| Literals | Literal, Boolean, Null, Interval | Constant values |
| Types | DataType, Cast, TryCast, SafeCast | Data types and casts |
| Identifiers | Identifier, Column, Table, Star | Name references |
§SQL Generation
Every Expression can be rendered back to SQL via Expression::sql()
(generic dialect) or Expression::sql_for() (specific dialect). The
actual generation logic lives in the generator module.
Structs§
- AIAgg
- AIAgg
- AIClassify
- AIClassify
- AddPartition
- AddPartition
- AggFunc
- Generic aggregate function base type
- Aggregate
Function - Represent a named aggregate function call with optional FILTER, ORDER BY, and LIMIT.
- Algorithm
Property - AlgorithmProperty
- Alias
- Represent an aliased expression (
expr AS name). - Aliases
- Aliases
- Allowed
Values Property - AllowedValuesProperty
- Alter
Column - AlterColumn
- Alter
Index - ALTER INDEX statement
- Alter
Sequence - ALTER SEQUENCE statement
- Alter
Session - AlterSession
- Alter
Set - AlterSet
- Alter
Sort Key - AlterSortKey
- Alter
Table - ALTER TABLE statement
- Alter
View - ALTER VIEW statement
- Analyze
- Analyze
- Analyze
Delete - AnalyzeDelete
- Analyze
Histogram - AnalyzeHistogram
- Analyze
List Chained Rows - AnalyzeListChainedRows
- Analyze
Sample - AnalyzeSample
- Analyze
Statistics - AnalyzeStatistics
- Analyze
Validate - AnalyzeValidate
- Analyze
With - AnalyzeWith
- Annotated
- Expression annotated with trailing comments (for round-trip preservation)
- Anonymous
- Anonymous
- Anonymous
AggFunc - AnonymousAggFunc
- Apply
- Apply
- Approx
Percentile Estimate - ApproxPercentileEstimate
- Approx
Percentile Func - APPROX_PERCENTILE function
- Approx
Quantile - ApproxQuantile
- Approx
Quantiles - ApproxQuantiles
- Approx
TopK - ApproxTopK
- Approx
TopK Accumulate - ApproxTopKAccumulate
- Approx
TopK Combine - ApproxTopKCombine
- Approx
TopK Estimate - ApproxTopKEstimate
- Approx
TopSum - ApproxTopSum
- ArgMax
- ArgMax
- ArgMin
- ArgMin
- Array
- Array expression
- Array
All - ArrayAll
- Array
Any - ArrayAny
- Array
Construct Compact - ArrayConstructCompact
- Array
Constructor - ARRAY constructor
- Array
Filter Func - ARRAY_FILTER function (with lambda)
- Array
Join Func - ARRAY_JOIN / ARRAY_TO_STRING function
- Array
Slice - Array slice (array[start:end])
- Array
Sort Func - ARRAY_SORT function
- Array
Sum - ArraySum
- Array
Transform Func - ARRAY_TRANSFORM / TRANSFORM function (with lambda)
- AtIndex
- AtIndex
- AtTime
Zone - AT TIME ZONE expression for timezone conversion
- Attach
- Attach
- Attach
Option - AttachOption
- Auto
Increment Column Constraint - AutoIncrementColumnConstraint - MySQL/TSQL auto-increment marker TSQL: outputs “IDENTITY”
- Auto
Increment Property - AutoIncrementProperty
- Auto
Refresh Property - AutoRefreshProperty
- Backup
Property - BackupProperty
- Base64
Decode Binary - Base64DecodeBinary
- Base64
Decode String - Base64DecodeString
- Base64
Encode - Base64Encode
- Between
- Represent a BETWEEN predicate (
x BETWEEN low AND high). - Binary
Func - Generic binary function (takes two arguments)
- Binary
Op - Represent a binary operation (two operands separated by an operator).
- Block
Compression Property - BlockCompressionProperty
- Booland
- Booland
- Boolean
Literal - Boolean literal
- Boolor
- Boolor
- Build
Property - BuildProperty
- Byte
String - ByteString
- Cache
- CACHE TABLE statement (Spark)
- Case
- Represent a CASE expression (both simple and searched forms).
- Case
Specific Column Constraint - CaseSpecificColumnConstraint
- Cast
- Represent a type cast expression.
- Cast
ToStr Type - CastToStrType
- Ceil
Func - CEIL function with optional decimals and time unit (Druid: CEIL(time TO unit))
- Changes
- Changes
- Char
Func - CHAR/CHR function with multiple args and optional USING charset e.g., CHAR(77, 77.3, ‘77.3’ USING utf8mb4) e.g., CHR(187 USING NCHAR_CS) – Oracle
- Character
SetColumn Constraint - CharacterSetColumnConstraint
- Character
SetProperty - CharacterSetProperty
- Check
Column Constraint - CheckColumnConstraint
- Check
Json - CheckJson
- Check
Xml - CheckXml
- Checksum
Property - ChecksumProperty
- Clone
- Clone
- Cluster
By - CLUSTER BY clause (Hive/Spark) Combines DISTRIBUTE BY and SORT BY on the same columns
- Clustered
ByProperty - ClusteredByProperty
- Collate
Property - CollateProperty
- Collation
Expr - Column
- Represent a column reference, optionally qualified by a table name.
- Column
Def - Column definition in CREATE TABLE
- Column
Prefix - ColumnPrefix
- Columns
- Columns
- Combined
AggFunc - CombinedAggFunc
- Combined
Parameterized Agg - CombinedParameterizedAgg
- Command
- SQL Command (COMMIT, ROLLBACK, BEGIN, etc.)
- Comment
- COMMENT ON statement
- Comment
Column Constraint - CommentColumnConstraint - Column comment marker
- Commit
- Commit
- Comprehension
- Comprehension
- Compress
- Compress
- Compress
Column Constraint - CompressColumnConstraint
- Computed
Column - Computed/generated column constraint
- Computed
Column Constraint - ComputedColumnConstraint
- Concat
Ws - CONCAT_WS function
- Conditional
Insert - ConditionalInsert
- Connect
- Oracle CONNECT BY clause for hierarchical queries
- Connect
ByRoot - Oracle CONNECT_BY_ROOT function - returns root row’s column value
- Constraint
- Constraint
- Constraint
Modifiers - Constraint modifiers (shared between table-level constraints)
- Convert
Func - CONVERT function (SQL Server style)
- Convert
Timezone - ConvertTimezone
- Convert
ToCharset - ConvertToCharset
- Copy
Parameter - COPY parameter (e.g., FILE_FORMAT = CSV or FORMAT PARQUET)
- Copy
Stmt - COPY statement (Snowflake, PostgreSQL, DuckDB, TSQL)
- Corr
- Corr
- Cosine
Distance - CosineDistance
- Count
Func - COUNT function with optional star
- Covar
Pop - CovarPop
- Covar
Samp - CovarSamp
- Create
Database - CREATE DATABASE statement
- Create
Function - CREATE FUNCTION statement
- Create
Index - CREATE INDEX statement
- Create
Procedure - CREATE PROCEDURE statement
- Create
Schema - CREATE SCHEMA statement
- Create
Sequence - CREATE SEQUENCE statement
- Create
Table - CREATE TABLE statement
- Create
Trigger - CREATE TRIGGER statement
- Create
Type - CREATE TYPE statement
- Create
View - CREATE VIEW statement
- Credentials
- Credentials for external access (S3, Azure, etc.)
- Credentials
Property - CredentialsProperty
- Cte
- Represent a single Common Table Expression definition.
- Cube
- Cube
- Cume
Dist - CUME_DIST function (DuckDB allows ORDER BY inside, Oracle allows hypothetical args with WITHIN GROUP)
- Current
Date - CURRENT_DATE (no arguments)
- Current
Datetime - CurrentDatetime
- Current
Schema - CurrentSchema
- Current
Schemas - CurrentSchemas
- Current
Time - CURRENT_TIME
- Current
Timestamp - CURRENT_TIMESTAMP
- Current
TimestampLTZ - CURRENT_TIMESTAMP_LTZ - Snowflake local timezone timestamp
- Current
User - CurrentUser
- DPipe
- DPipe
- Data
Blocksize Property - DataBlocksizeProperty
- Data
Deletion Property - DataDeletionProperty
- Date
AddFunc - DATE_ADD / DATE_SUB function
- DateBin
- DateBin
- Date
Diff Func - DATEDIFF function
- Date
Format Column Constraint - DateFormatColumnConstraint
- Date
Format Func - DATE_FORMAT / FORMAT_DATE function
- Date
From Parts - DateFromParts
- Date
Trunc Func - DATE_TRUNC function
- Datetime
- Datetime
- Datetime
Add - DatetimeAdd
- Datetime
Diff - DatetimeDiff
- Datetime
Sub - DatetimeSub
- Datetime
Trunc - DatetimeTrunc
- Dayname
- Dayname
- Declare
- Declare
- Declare
Item - DeclareItem
- Decode
Case - DecodeCase
- Decode
Func - DECODE function (Oracle style)
- Decompress
Binary - DecompressBinary
- Decompress
String - DecompressString
- Decrypt
- Decrypt
- Decrypt
Raw - DecryptRaw
- Default
Column Constraint - DefaultColumnConstraint - DEFAULT value for a column
- Definer
Property - DefinerProperty
- Delete
- DELETE statement
- Dense
Rank - DENSE_RANK function (Oracle allows hypothetical args with WITHIN GROUP)
- Describe
- DESCRIBE statement - shows table structure or query plan
- Detach
- Detach
- Dict
Property - DictProperty
- Dict
Range - DictRange
- Directory
- Directory
- Directory
Insert - Directory insert for INSERT OVERWRITE DIRECTORY (Hive/Spark)
- Dist
KeyProperty - DistKeyProperty
- Dist
Style Property - DistStyleProperty
- Distribute
By - DISTRIBUTE BY clause (Hive/Spark) Controls how rows are distributed across reducers
- Distributed
ByProperty - DistributedByProperty
- Domain
Constraint - Domain constraint
- DotAccess
- Dot access (struct.field)
- DotProduct
- DotProduct
- Drop
Database - DROP DATABASE statement
- Drop
Function - DROP FUNCTION statement
- Drop
Index - DROP INDEX statement
- Drop
Namespace - DROP NAMESPACE statement (Spark/Databricks - alias for DROP SCHEMA)
- Drop
Partition - DropPartition
- Drop
Procedure - DROP PROCEDURE statement
- Drop
Schema - DROP SCHEMA statement
- Drop
Sequence - DROP SEQUENCE statement
- Drop
Table - DROP TABLE statement
- Drop
Trigger - DROP TRIGGER statement
- Drop
Type - DROP TYPE statement
- Drop
View - DROP VIEW statement
- Duplicate
KeyProperty - DuplicateKeyProperty
- Elt
- Elt
- Encode
- Encode
- Encode
Property - EncodeProperty
- Encrypt
- Encrypt
- Encrypt
Raw - EncryptRaw
- Engine
Property - EngineProperty
- Enviroment
Property - EnviromentProperty
- Ephemeral
Column Constraint - EphemeralColumnConstraint
- Equal
Null - EqualNull
- Euclidean
Distance - EuclideanDistance
- Except
- Represent an EXCEPT (MINUS) set operation between two query expressions.
- Exclude
Element - Element in an EXCLUDE constraint: expression WITH operator
- Execute
AsProperty - ExecuteAsProperty
- Execute
Parameter - Named parameter in EXEC statement: @name=value
- Execute
Statement - EXEC/EXECUTE statement (TSQL stored procedure call) Syntax: EXEC [schema.]procedure_name [@param=value, …]
- Exists
- Represent an EXISTS predicate (
EXISTS (SELECT ...)orNOT EXISTS (...)). - Export
- Export
- External
Property - ExternalProperty
- Extract
Func - EXTRACT function
- Fallback
Property - FallbackProperty
- Farm
Fingerprint - FarmFingerprint
- Features
AtTime - FeaturesAtTime
- Fetch
- FETCH FIRST/NEXT clause (SQL standard)
- File
Format Property - FileFormatProperty
- Filter
- Filter
- Float64
- Float64
- Floor
Func - FLOOR function with optional scale and time unit (Druid: FLOOR(time TO unit))
- ForIn
- ForIn
- Foreign
Key - ForeignKey
- Foreign
KeyRef - Foreign key reference
- Format
- Format
- Format
Phrase - Format override for a column in Teradata
- Freespace
Property - FreespaceProperty
- From
- Represent the FROM clause of a SELECT statement.
- From
Base - FromBase
- From
Time Zone - FromTimeZone
- From
Unixtime Func - FROM_UNIXTIME function
- Function
- Represent a scalar function call (e.g.
UPPER(name),COALESCE(a, b)). - Function
Parameter - Function parameter
- Function
SetOption - A SET option in CREATE FUNCTION (PostgreSQL)
- GapFill
- GapFill
- Generate
Date Array - GenerateDateArray
- Generate
Embedding - GenerateEmbedding
- Generate
Series - GenerateSeries
- Generate
Timestamp Array - GenerateTimestampArray
- Generated
AsIdentity - Generated identity column constraint
- Generated
AsIdentity Column Constraint - GeneratedAsIdentityColumnConstraint
- Generated
AsRow - TSQL temporal column constraint: GENERATED ALWAYS AS ROW START|END [HIDDEN]
- Generated
AsRow Column Constraint - GeneratedAsRowColumnConstraint
- Get
- Get
- GetExtract
- GetExtract
- Getbit
- Getbit
- Grant
- GRANT statement
- Grant
Principal - Principal in GRANT/REVOKE (user, role, etc.)
- Grant
Privilege - GrantPrivilege
- Group
- Group
- GroupBy
- Represent a GROUP BY clause with optional ALL/DISTINCT and WITH TOTALS modifiers.
- Group
Concat Func - GROUP_CONCAT function (MySQL style)
- Grouping
- Grouping
- Grouping
Id - GroupingId
- Grouping
Sets - GroupingSets
- HashAgg
- HashAgg
- Having
- Represent a HAVING clause containing a predicate over aggregate results.
- Having
Max - HavingMax
- Heredoc
- Heredoc
- HexEncode
- HexEncode
- HexString
Expr - HexStringExpr - Hex string expression (not literal) BigQuery: converts to FROM_HEX(this)
- Hint
- Query hint
- Historical
Data - Historical data / Time travel (Snowflake) - BEFORE (STATEMENT => …) or AT (TIMESTAMP => …)
- Hll
- Hll
- Identifier
- Represent a SQL identifier (table name, column name, alias, keyword-as-name, etc.).
- IfFunc
- IF function
- In
- Represent an IN predicate (
x IN (1, 2, 3)orx IN (SELECT ...)). - InOut
Column Constraint - InOutColumnConstraint
- Include
Property - IncludeProperty
- Index
- Index
- Index
Column - Index column specification
- Index
Column Constraint - IndexColumnConstraint
- Index
Constraint Option - IndexConstraintOption
- Index
Parameters - IndexParameters
- Index
Table Hint - IndexTableHint
- Inherits
Property - InheritsProperty
- Input
Model Property - InputModelProperty
- Input
Output Format - InputOutputFormat
- Insert
- INSERT statement
- Install
- Install
- Intersect
- Represent an INTERSECT set operation between two query expressions.
- Interval
- Interval expression
- Interval
Op - IntervalOp
- Interval
Span - Interval span for ranges like HOUR TO SECOND
- Interval
Span Expr - Expression-based interval span for Oracle (e.g., DAY(9) TO SECOND(3)) Unlike IntervalSpan, this uses expressions to represent units with optional precision
- Into
Clause - Into
- Introducer
- Introducer
- IsJson
- IS JSON predicate (SQL standard) Checks if a value is valid JSON
- IsNull
- IS NULL predicate
- IsTrue
False - IS TRUE / IS FALSE predicate
- Isolated
Loading Property - IsolatedLoadingProperty
- JSON
- JSON
- JSON
Array - JSONArray
- JSON
Array Agg - JSONArrayAgg
- JSON
Array Append - JSONArrayAppend
- JSON
Array Contains - JSONArrayContains
- JSON
Array Insert - JSONArrayInsert
- JSONB
Exists - JSONBExists
- JSONB
Extract Scalar - JSONBExtractScalar
- JSONB
Object Agg - JSONBObjectAgg
- JSON
Cast - JSONCast
- JSON
Column Def - JSONColumnDef
- JSON
Exists - JSONExists
- JSON
Extract - JSONExtract
- JSON
Extract Array - JSONExtractArray
- JSON
Extract Quote - JSONExtractQuote
- JSON
Extract Scalar - JSONExtractScalar
- JSON
Format - JSONFormat
- JSON
KeyValue - JSONKeyValue
- JSON
Keys - JSONKeys
- JSON
Keys AtDepth - JSONKeysAtDepth
- JSON
Object - JSONObject
- JSON
Object Agg - JSONObjectAgg
- JSON
Path - JSONPath
- JSON
Path Filter - JSONPathFilter
- JSON
Path Key - JSONPathKey
- JSON
Path Recursive - JSONPathRecursive
- JSON
Path Root - JSONPathRoot - Represents $ in JSON path expressions
- JSON
Path Script - JSONPathScript
- JSON
Path Selector - JSONPathSelector
- JSON
Path Slice - JSONPathSlice
- JSON
Path Subscript - JSONPathSubscript
- JSON
Path Union - JSONPathUnion
- JSON
Remove - JSONRemove
- JSON
Schema - JSONSchema
- JSONSet
- JSONSet
- JSON
Strip Nulls - JSONStripNulls
- JSON
Table - JSONTable
- JSON
Type - JSONType
- JSON
Value - JSONValue
- JSON
Value Array - JSONValueArray
- Jarowinkler
Similarity - JarowinklerSimilarity
- Join
- Represent a JOIN clause between two table sources.
- Join
Hint - JoinHint
- Joined
Table - Parenthesized table expression with joins Represents: (tbl1 CROSS JOIN tbl2) or ((SELECT 1) CROSS JOIN (SELECT 2))
- Journal
Property - JournalProperty
- Json
Array AggFunc - JSON_ARRAYAGG function
- Json
Extract Func - JSON_EXTRACT / JSON_EXTRACT_SCALAR function
- Json
Modify Func - JSON_SET / JSON_INSERT function
- Json
Object AggFunc - JSON_OBJECTAGG function
- Json
Object Func - JSON_OBJECT function
- Json
Path Func - JSON path extraction
- Keep
- Oracle KEEP clause for aggregate functions Syntax: aggregate_function KEEP (DENSE_RANK FIRST|LAST ORDER BY column [ASC|DESC])
- Kill
- KILL statement (MySQL/MariaDB)
KILL [CONNECTION | QUERY]
- Lambda
Expr - Lambda expression
- Language
Property - LanguageProperty
- Last
DayFunc - LAST_DAY function with optional date part (for BigQuery granularity like WEEK(SUNDAY))
- Lateral
- Lateral
- Lateral
View - LATERAL VIEW clause (Hive/Spark) Used for unnesting arrays/maps with EXPLODE, POSEXPLODE, etc.
- Lead
LagFunc - LEAD / LAG function
- Left
Right Func - LEFT/RIGHT function
- LikeOp
- LIKE/ILIKE operation with optional ESCAPE clause and quantifier (ANY/ALL)
- Like
Property - LikeProperty
- Limit
- Represent a LIMIT clause that restricts the number of returned rows.
- Limit
Options - LimitOptions
- List
- List
- List
AggFunc - LISTAGG function (Oracle style)
- Load
Data - LOAD DATA statement (Hive)
- Localtime
- Localtime
- Localtimestamp
- Localtimestamp
- Location
Property - LocationProperty
- Lock
- Lock
- Lock
Property - LockProperty
- Locking
Property - LockingProperty
- Locking
Statement - LockingStatement
- LogFunc
- LOG function
- LogProperty
- LogProperty
- MD5Digest
- MD5Digest
- MLForecast
- MLForecast
- MLTranslate
- MLTranslate
- Make
Date Func - MAKE_DATE function
- Make
Interval - MakeInterval
- Make
Timestamp Func - MAKE_TIMESTAMP function
- Manhattan
Distance - ManhattanDistance
- Map
- Map
- MapCat
- MapCat
- MapConstructor
- MAP constructor
- MapDelete
- MapDelete
- MapInsert
- MapInsert
- MapPick
- MapPick
- Masking
Policy Column Constraint - MaskingPolicyColumnConstraint
- Match
Against - MatchAgainst
- Match
Recognize - MATCH_RECOGNIZE clause for row pattern matching (Oracle/Snowflake/Presto/Trino)
- Match
Recognize Measure - MEASURES expression with optional RUNNING/FINAL semantics
- Materialized
Property - MaterializedProperty
- Merge
- Merge
- Merge
Block Ratio Property - MergeBlockRatioProperty
- Merge
TreeTTL - MergeTreeTTL
- Merge
TreeTTL Action - MergeTreeTTLAction
- Method
Call - Method call (expr.method(args))
- Minhash
- Minhash
- Model
Attribute - ModelAttribute
- Monthname
- Monthname
- Multitable
Inserts - MultitableInserts
- NTile
Func - NTILE function (DuckDB allows ORDER BY inside)
- Named
Argument - Named argument in function call: name => value or name := value
- Named
Struct Func - NAMED_STRUCT function
- Named
Window - Named window definition (WINDOW w AS (…))
- Next
Value For - NextValueFor
- Normal
- Normal
- Normalize
- Normalize
- NotNull
Column Constraint - NotNullColumnConstraint
- NthValue
Func - NTH_VALUE function
- Ntile
- Ntile
- Null
- NULL literal
- Nullif
- Nullif
- Number
ToStr - NumberToStr
- Nvl2
Func - NVL2 function
- Object
Agg - ObjectAgg
- Object
Identifier - ObjectIdentifier
- Object
Insert - ObjectInsert
- Offset
- OFFSET clause
- OnCluster
- OnCluster
- OnCommit
Property - OnCommitProperty
- OnCondition
- OnCondition
- OnConflict
- OnConflict
- OnProperty
- OnProperty
- Opclass
- Opclass
- OpenJSON
- OpenJSON
- OpenJSON
Column Def - OpenJSONColumnDef
- Operator
- Operator
- OrderBy
- Represent an ORDER BY clause containing one or more sort specifications.
- Ordered
- Represent an expression with sort direction and null ordering.
- Output
Clause - OUTPUT clause (TSQL) - used in INSERT, UPDATE, DELETE
- Output
Model Property - OutputModelProperty
- Over
- OVER clause
- Overflow
Truncate Behavior - OverflowTruncateBehavior
- Overlaps
Expr - OVERLAPS expression Supports two forms:
- Overlay
Func - OVERLAY function - OVERLAY(string PLACING replacement FROM position [FOR length])
- Pad
- Pad
- PadFunc
- LPAD/RPAD function
- Parameter
- Parameter (parameterized queries)
- Parameterized
Agg - ParameterizedAgg
- Paren
- Represent an explicit parenthesized expression for grouping precedence.
- Parse
Datetime - ParseDatetime
- ParseIp
- ParseIp
- ParseJSON
- ParseJSON
- Parse
Time - ParseTime
- Parse
Url - ParseUrl
- Partition
- Partition - represents PARTITION/SUBPARTITION clause
- Partition
Bound Spec - PartitionBoundSpec
- Partition
ByList Property - PartitionByListProperty
- Partition
ByRange Property - PartitionByRangeProperty
- Partition
ByRange Property Dynamic - PartitionByRangePropertyDynamic
- Partition
ByTruncate - PartitionByTruncate
- Partition
List - PartitionList
- Partition
Range - PartitionRange
- Partitioned
ByBucket - PartitionedByBucket
- Partitioned
ByProperty - PartitionedByProperty
- Partitioned
OfProperty - PartitionedOfProperty
- Path
Column Constraint - PathColumnConstraint - PATH ‘xpath’ for XMLTABLE/JSON_TABLE columns
- Percent
Rank - PERCENT_RANK function (DuckDB allows ORDER BY inside, Oracle allows hypothetical args with WITHIN GROUP)
- Percentile
Func - PERCENTILE_CONT / PERCENTILE_DISC function
- Period
ForSystem Time Constraint - PeriodForSystemTimeConstraint
- Pi
- PI function (no arguments)
- Pivot
- PIVOT operation - supports both standard and DuckDB simplified syntax
- Pivot
Alias - PIVOT alias for aliasing pivot expressions The alias can be an identifier or an expression (for Oracle/BigQuery string concatenation aliases)
- Pivot
Any - PivotAny
- Placeholder
- Placeholder expression
- Position
Func - POSITION/INSTR function
- Pragma
- PRAGMA statement (SQLite)
- PreWhere
- PREWHERE clause (ClickHouse) - early filtering before WHERE
- Predict
- Predict
- Previous
Day - PreviousDay
- Primary
Key - PrimaryKey
- Primary
KeyColumn Constraint - PrimaryKeyColumnConstraint
- Prior
- Oracle PRIOR expression - references parent row’s value in CONNECT BY
- Privilege
- A privilege with optional column list for GRANT/REVOKE Examples: SELECT, UPDATE(col1, col2), ALL(col1, col2, col3)
- Projection
Def - ProjectionDef
- Properties
- Properties
- Property
- Property
- Pseudo
Type - PseudoType
- Pseudocolumn
- Pseudocolumn expression (Oracle ROWNUM, ROWID, LEVEL, etc.) These are special identifiers that should not be quoted
- PutStmt
- PUT statement (Snowflake)
- Qualify
- Represent a QUALIFY clause for filtering on window function results.
- Quantified
Expr - ANY / ALL quantified expression
- Quantile
- Quantile
- Query
Band - QueryBand
- Query
Option - QueryOption
- Query
Transform - QueryTransform
- Rand
- RAND function (optional seed, or Teradata RANDOM(lower, upper))
- Randn
- Randn
- Random
- RANDOM function (no arguments)
- Randstr
- Randstr
- Range
Bucket - RangeBucket
- RangeN
- RangeN
- Rank
- RANK function (DuckDB allows ORDER BY inside, Oracle allows hypothetical args with WITHIN GROUP)
- Raw
- Raw/unparsed SQL
- ReadCSV
- ReadCSV
- Read
Parquet - ReadParquet
- Recursive
With Search - RecursiveWithSearch
- Reduce
- Reduce
- Reference
- Reference
- Refresh
- Refresh
- Refresh
Trigger Property - RefreshTriggerProperty - Doris REFRESH clause for materialized views e.g., REFRESH COMPLETE ON MANUAL, REFRESH AUTO ON SCHEDULE EVERY 5 MINUTE
- Regexp
Count - RegexpCount
- Regexp
Extract All - RegexpExtractAll
- Regexp
Extract Func - REGEXP_EXTRACT function
- Regexp
Full Match - RegexpFullMatch
- Regexp
Func - REGEXP_LIKE function
- RegexpI
Like - RegexpILike
- Regexp
Instr - RegexpInstr
- Regexp
Replace Func - REGEXP_REPLACE function
- Regexp
Split - RegexpSplit
- Regr
Avgx - RegrAvgx
- Regr
Avgy - RegrAvgy
- Regr
Count - RegrCount
- Regr
Intercept - RegrIntercept
- RegrR2
- RegrR2
- Regr
Slope - RegrSlope
- RegrSxx
- RegrSxx
- RegrSxy
- RegrSxy
- RegrSyy
- RegrSyy
- Regr
Valx - RegrValx
- Regr
Valy - RegrValy
- Remote
With Connection Model Property - RemoteWithConnectionModelProperty
- Rename
Column - RenameColumn
- Repeat
Func - REPEAT function
- Replace
Func - REPLACE function
- Replace
Partition - ReplacePartition
- Returning
- Returning
- Returns
Property - ReturnsProperty
- Revoke
- REVOKE statement
- Rollback
- Rollback
- Rollup
- Rollup
- Rollup
Index - RollupIndex - A single rollup index: name(col1, col2)
- Rollup
Property - RollupProperty - StarRocks ROLLUP (index_name(col1, col2), …)
- Round
Func - ROUND function
- RowFormat
- ROW FORMAT clause for Hive/Spark
- RowFormat
Delimited Property - RowFormatDelimitedProperty
- RowFormat
Property - RowFormatProperty
- RowFormat
Serde Property - RowFormatSerdeProperty
- RowNumber
- ROW_NUMBER function (no arguments)
- Rows
From - RowsFrom - PostgreSQL ROWS FROM (func1(args) AS alias1(…), func2(args) AS alias2(…)) syntax Used for set-returning functions with typed column definitions
- SHA2
- SHA2
- SHA2
Digest - SHA2Digest
- SafeAdd
- SafeAdd
- Safe
Divide - SafeDivide
- Safe
Multiply - SafeMultiply
- Safe
Subtract - SafeSubtract
- Sample
- SAMPLE / TABLESAMPLE clause
- Sample
Property - SampleProperty
- Schema
- Schema
- Schema
Comment Property - SchemaCommentProperty
- Scope
Resolution - ScopeResolution
- Search
- Search
- Search
Ip - SearchIp
- Security
Property - SecurityProperty
- Select
- Represent a complete SELECT statement.
- Select
Into - INTO clause for SELECT INTO statements
- Semantic
View - SemanticView
- Sequence
Func - SEQUENCE / GENERATE_SERIES function
- Sequence
Properties - SequenceProperties
- Serde
Properties - SerdeProperties
- Session
Parameter - SessionParameter
- Session
User - SessionUser - MySQL/PostgreSQL SESSION_USER function
- Set
- Set
- SetConfig
Property - SetConfigProperty
- SetItem
- A single SET item (variable assignment)
- SetOperation
- SetOperation
- SetProperty
- SetProperty
- SetStatement
- SET variable statement
- Settings
Property - SettingsProperty
- Sharing
Property - SharingProperty
- Show
- SHOW statement - displays database objects
- Similar
ToExpr - SIMILAR TO expression
- Slice
- Slice
- Sort
Array - SortArray
- SortBy
- SORT BY clause (Hive/Spark) Sorts data within each reducer (local sort, not global)
- Sort
KeyProperty - SortKeyProperty
- Split
Func - SPLIT function
- Split
Part - SplitPart
- SqlComment
- SQL Comment preservation
- SqlRead
Write Property - SqlReadWriteProperty
- SqlSecurity
Property - SqlSecurityProperty
- StDistance
- StDistance
- StPoint
- StPoint
- Stability
Property - StabilityProperty
- Stage
Reference - Stage reference (Snowflake) - @stage_name or @namespace.stage/path
- Standard
Hash - StandardHash
- Star
- Represent a wildcard star expression (
*,table.*). - Storage
Handler Property - StorageHandlerProperty
- StrPosition
- StrPosition
- StrTo
Date - StrToDate
- StrTo
Map - StrToMap
- StrTo
Time - StrToTime
- StrTo
Unix - StrToUnix
- Stream
- STREAM definition (Snowflake) - for change data capture
- String
AggFunc - STRING_AGG function (PostgreSQL/Standard SQL)
- String
Func - StringFunc - String type conversion function (BigQuery STRING)
- String
ToArray - StringToArray
- Struct
- Struct expression
- Struct
Constructor - STRUCT constructor
- Struct
Extract Func - STRUCT_EXTRACT function
- Struct
Field - Struct field with optional OPTIONS clause (BigQuery) and COMMENT (Spark/Databricks)
- Stuff
- Stuff
- Subquery
- Represent a parenthesized subquery expression.
- Subscript
- Subscript access (array[index] or map[key])
- Substring
Func - SUBSTRING function
- Substring
Index - SUBSTRING_INDEX(str, delim, count)
- SumIf
Func - SUM_IF / COUNT_IF function
- Summarize
- Summarize
- Systimestamp
- Systimestamp
- Table
Alias - TableAlias
- Table
Argument - TABLE ref or MODEL ref used as a function argument (BigQuery) e.g., GAP_FILL(TABLE device_data, …) or ML.PREDICT(MODEL mydataset.mymodel, …)
- Table
From Rows - TableFromRows
- Table
Ref - Represent a table reference with optional schema and catalog qualifiers.
- Table
Sample - TableSample - wraps an expression with a TABLESAMPLE clause Used when TABLESAMPLE follows a non-Table expression (subquery, function, etc.)
- Tag
- Tags are used for generating arbitrary sql like SELECT x.
- Tags
- Tags
- Temporary
Property - TemporaryProperty
- Teradata
Index - Teradata index specification for CREATE TABLE
- TimeAdd
- TimeAdd
- Time
Diff - TimeDiff
- Time
From Parts - TimeFromParts
- Time
Slice - TimeSlice
- Time
StrTo Time - TimeStrToTime
- TimeSub
- TimeSub
- Time
ToStr - TimeToStr
- Time
Trunc - TimeTrunc
- Time
Unit - Automatically converts unit arg into a var.
- Timestamp
Add - TimestampAdd
- Timestamp
Diff - TimestampDiff
- Timestamp
From Parts - TimestampFromParts
- Timestamp
Func - TimestampFunc - TIMESTAMP constructor function
- Timestamp
Sub - TimestampSub
- Timestamp
TzFrom Parts - TimestampTzFromParts
- ToBinary
- ToBinary
- ToBoolean
- ToBoolean
- ToChar
- ToChar
- ToDate
Func - TO_DATE function
- ToDecfloat
- ToDecfloat
- ToDouble
- ToDouble
- ToFile
- ToFile
- ToMap
- ToMap - Materialize-style map constructor Can hold either:
- ToNumber
- ToNumber
- ToTable
Property - ToTableProperty
- ToTimestamp
Func - TO_TIMESTAMP function
- Top
- TOP clause (SQL Server)
- Transaction
- Transaction
- Transform
- Transform
- Transform
Func - TRANSFORM_KEYS / TRANSFORM_VALUES function
- Transform
Model Property - TransformModelProperty
- Transient
Property - TransientProperty
- Translate
- Translate
- Translate
Characters - TranslateCharacters
- Trigger
Referencing - Trigger REFERENCING clause
- Trim
Func - TRIM function
- Truncate
- TRUNCATE TABLE statement
- Truncate
Func - TRUNCATE / TRUNC function
- Truncate
Table - TruncateTable
- Truncate
Table Entry - A table entry in a TRUNCATE statement, with optional ONLY modifier and * suffix
- TryBase64
Decode Binary - TryBase64DecodeBinary
- TryBase64
Decode String - TryBase64DecodeString
- TryTo
Decfloat - TryToDecfloat
- TsOr
DsAdd - TsOrDsAdd
- TsOr
DsDiff - TsOrDsDiff
- TsOr
DsTo Date - TsOrDsToDate
- TsOr
DsTo Time - TsOrDsToTime
- Tuple
- Tuple expression
- Type
Attribute - Type attribute for composite types
- Unary
Func - Generic unary function (takes a single argument)
- UnaryOp
- Represent a unary operation (single operand with a prefix operator).
- Uncache
- UNCACHE TABLE statement (Spark)
- Unhex
- Unhex
- Unicode
String - UnicodeString
- Uniform
- Uniform
- Union
- Represent a UNION set operation between two query expressions.
- Unique
Column Constraint - UniqueColumnConstraint
- Unique
KeyProperty - UniqueKeyProperty
- Unix
Timestamp Func - UNIX_TIMESTAMP function
- Unix
ToStr - UnixToStr
- Unix
ToTime - UnixToTime
- Unnest
Func - UNNEST function
- Unpivot
- UNPIVOT operation
- Unpivot
Columns - UnpivotColumns
- Update
- UPDATE statement
- Use
- USE statement (USE database, USE ROLE, USE WAREHOUSE, USE CATALOG, USE SCHEMA)
- User
Defined Function - UserDefinedFunction
- Using
Data - USING DATA clause for data import statements
- Using
Template Property - UsingTemplateProperty
- UtcTime
- UtcTime
- UtcTimestamp
- UtcTimestamp
- Uuid
- Uuid
- Value
Func - FIRST_VALUE / LAST_VALUE function
- Values
- VALUES table constructor: VALUES (1, ‘a’), (2, ‘b’)
- Var
- Var - Simple variable reference (for SQL variables, keywords as values)
- VarArg
Func - Variable argument function
- VarMap
- VarMap
- Vector
Search - VectorSearch
- Version
- Version
- View
Attribute Property - ViewAttributeProperty
- View
Column - View column definition with optional COMMENT and OPTIONS (BigQuery)
- Volatile
Property - VolatileProperty
- Watermark
Column Constraint - WatermarkColumnConstraint
- Week
- Week
- When
- When
- Whens
- Wraps around one or more WHEN [NOT] MATCHED […] clauses.
- Where
- Represent a WHERE clause containing a boolean filter predicate.
- Width
Bucket - WidthBucket
- Window
Frame - Window frame
- Window
Function - Represent a window function call with its OVER clause.
- Window
Spec - Window specification
- With
- Represent a WITH clause containing one or more Common Table Expressions (CTEs).
- With
Data Property - WithDataProperty
- With
Fill - WithFill
- With
Journal Table Property - WithJournalTableProperty
- With
Operator - WithOperator
- With
Procedure Options - WithProcedureOptions
- With
Schema Binding Property - WithSchemaBindingProperty
- With
System Versioning Property - WithSystemVersioningProperty
- With
Table Hint - WithTableHint
- Within
Group - WITHIN GROUP clause (for ordered-set aggregate functions)
- XMLElement
- XMLElement
- XMLGet
- XMLGet
- XMLKey
Value Option - XMLKeyValueOption
- XMLTable
- XMLTable
- XmlNamespace
- XML Namespace declaration
- Xor
- Xor
- Zipf
- Zipf
Enums§
- Alter
Column Action - Actions for ALTER COLUMN
- Alter
Index Action - Actions for ALTER INDEX
- Alter
Table Action - Actions for ALTER TABLE
- Alter
View Action - Actions for ALTER VIEW
- Column
Constraint - Column-level constraint
- Column
Position - Column position for ADD COLUMN (MySQL/MariaDB)
- Constraint
Type - Type of column constraint for tracking order
- Data
Type - Enumerate all SQL data types recognized by the parser.
- Database
Option - Database option
- Date
Time Field - Expression
- Represent any SQL expression or statement as a single, recursive AST node.
- Function
Body - Function body
- Function
Property Kind - Types of properties in CREATE FUNCTION for tracking their original order
- Function
Security - Function security (DEFINER, INVOKER, or NONE)
- Function
SetValue - The value of a SET option
- Hint
Expression - Individual hint expression
- Interval
Unit - Interval
Unit Spec - Specification for interval unit - can be a simple unit, a span (HOUR TO SECOND), or an expression
- Join
Kind - Enumerate all supported SQL join types.
- Json
Null Handling - JSON null handling options
- Json
Unique Keys - JSON unique keys constraint variants
- Like
Option Action - Action for LIKE clause options
- List
AggOverflow - LISTAGG ON OVERFLOW behavior
- Literal
- Represent a SQL literal value.
- Match
Recognize After - AFTER MATCH SKIP behavior
- Match
Recognize Rows - Row output semantics for MATCH_RECOGNIZE
- Match
Recognize Semantics - Semantics for MEASURES in MATCH_RECOGNIZE
- Match
Type - MATCH type for foreign keys
- Named
ArgSeparator - Separator style for named arguments
- OnCommit
- ON COMMIT behavior for temporary tables
- Parameter
Mode - Parameter mode (IN, OUT, INOUT)
- Parameter
Style - Parameter placeholder styles
- Pseudocolumn
Type - Pseudocolumn type
- Quantified
Op - Comparison operator for quantified expressions
- Referential
Action - Referential action for foreign keys
- Sample
Method - Sample method
- SeqProp
Kind - Sequence property tag for ordering
- Sequence
Bound - Sequence bound (value or NO MINVALUE/NO MAXVALUE)
- Sort
Order - Sort order for PRIMARY KEY ASC/DESC
- SqlData
Access - SQL data access characteristics for functions
- Table
Constraint - Table-level constraint
- Teradata
Index Kind - Kind of Teradata index
- Trigger
Body - Trigger body
- Trigger
Event - Trigger event (INSERT, UPDATE, DELETE, TRUNCATE)
- Trigger
ForEach - Trigger FOR EACH clause
- Trigger
Timing - Trigger timing (BEFORE, AFTER, INSTEAD OF)
- Trim
Position - Truncate
Identity - TRUNCATE identity option
- Truncate
Target - TRUNCATE target type
- Type
Definition - Type definition
- UseKind
- Kind of USE statement
- Window
Frame Bound - Window
Frame Exclude - EXCLUDE clause for window frames
- Window
Frame Kind