Skip to main content

Module expressions

Module expressions 

Source
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

GroupExamplesPurpose
QueriesSelect, Union, Intersect, Except, SubqueryTop-level query structures
DMLInsert, Update, Delete, Merge, CopyData manipulation
DDLCreateTable, AlterTable, DropView, CreateIndexSchema definition
ClausesFrom, Join, Where, GroupBy, OrderBy, WithQuery clauses
OperatorsAnd, Or, Add, Eq, Like, NotBinary and unary operations
FunctionsFunction, AggregateFunction, WindowFunction, Count, SumScalar, aggregate, and window functions
LiteralsLiteral, Boolean, Null, IntervalConstant values
TypesDataType, Cast, TryCast, SafeCastData types and casts
IdentifiersIdentifier, Column, Table, StarName 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
AggregateFunction
Represent a named aggregate function call with optional FILTER, ORDER BY, and LIMIT.
AlgorithmProperty
AlgorithmProperty
Alias
Represent an aliased expression (expr AS name).
Aliases
Aliases
AllowedValuesProperty
AllowedValuesProperty
AlterColumn
AlterColumn
AlterIndex
ALTER INDEX statement
AlterSequence
ALTER SEQUENCE statement
AlterSession
AlterSession
AlterSet
AlterSet
AlterSortKey
AlterSortKey
AlterTable
ALTER TABLE statement
AlterView
ALTER VIEW statement
Analyze
Analyze
AnalyzeDelete
AnalyzeDelete
AnalyzeHistogram
AnalyzeHistogram
AnalyzeListChainedRows
AnalyzeListChainedRows
AnalyzeSample
AnalyzeSample
AnalyzeStatistics
AnalyzeStatistics
AnalyzeValidate
AnalyzeValidate
AnalyzeWith
AnalyzeWith
Annotated
Expression annotated with trailing comments (for round-trip preservation)
Anonymous
Anonymous
AnonymousAggFunc
AnonymousAggFunc
Apply
Apply
ApproxPercentileEstimate
ApproxPercentileEstimate
ApproxPercentileFunc
APPROX_PERCENTILE function
ApproxQuantile
ApproxQuantile
ApproxQuantiles
ApproxQuantiles
ApproxTopK
ApproxTopK
ApproxTopKAccumulate
ApproxTopKAccumulate
ApproxTopKCombine
ApproxTopKCombine
ApproxTopKEstimate
ApproxTopKEstimate
ApproxTopSum
ApproxTopSum
ArgMax
ArgMax
ArgMin
ArgMin
Array
Array expression
ArrayAll
ArrayAll
ArrayAny
ArrayAny
ArrayConstructCompact
ArrayConstructCompact
ArrayConstructor
ARRAY constructor
ArrayFilterFunc
ARRAY_FILTER function (with lambda)
ArrayJoinFunc
ARRAY_JOIN / ARRAY_TO_STRING function
ArraySlice
Array slice (array[start:end])
ArraySortFunc
ARRAY_SORT function
ArraySum
ArraySum
ArrayTransformFunc
ARRAY_TRANSFORM / TRANSFORM function (with lambda)
AtIndex
AtIndex
AtTimeZone
AT TIME ZONE expression for timezone conversion
Attach
Attach
AttachOption
AttachOption
AutoIncrementColumnConstraint
AutoIncrementColumnConstraint - MySQL/TSQL auto-increment marker TSQL: outputs “IDENTITY”
AutoIncrementProperty
AutoIncrementProperty
AutoRefreshProperty
AutoRefreshProperty
BackupProperty
BackupProperty
Base64DecodeBinary
Base64DecodeBinary
Base64DecodeString
Base64DecodeString
Base64Encode
Base64Encode
Between
Represent a BETWEEN predicate (x BETWEEN low AND high).
BinaryFunc
Generic binary function (takes two arguments)
BinaryOp
Represent a binary operation (two operands separated by an operator).
BlockCompressionProperty
BlockCompressionProperty
Booland
Booland
BooleanLiteral
Boolean literal
Boolor
Boolor
BuildProperty
BuildProperty
ByteString
ByteString
Cache
CACHE TABLE statement (Spark)
Case
Represent a CASE expression (both simple and searched forms).
CaseSpecificColumnConstraint
CaseSpecificColumnConstraint
Cast
Represent a type cast expression.
CastToStrType
CastToStrType
CeilFunc
CEIL function with optional decimals and time unit (Druid: CEIL(time TO unit))
Changes
Changes
CharFunc
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
CharacterSetColumnConstraint
CharacterSetColumnConstraint
CharacterSetProperty
CharacterSetProperty
CheckColumnConstraint
CheckColumnConstraint
CheckJson
CheckJson
CheckXml
CheckXml
ChecksumProperty
ChecksumProperty
Clone
Clone
ClusterBy
CLUSTER BY clause (Hive/Spark) Combines DISTRIBUTE BY and SORT BY on the same columns
ClusteredByProperty
ClusteredByProperty
CollateProperty
CollateProperty
CollationExpr
Column
Represent a column reference, optionally qualified by a table name.
ColumnDef
Column definition in CREATE TABLE
ColumnPrefix
ColumnPrefix
Columns
Columns
CombinedAggFunc
CombinedAggFunc
CombinedParameterizedAgg
CombinedParameterizedAgg
Command
SQL Command (COMMIT, ROLLBACK, BEGIN, etc.)
Comment
COMMENT ON statement
CommentColumnConstraint
CommentColumnConstraint - Column comment marker
Commit
Commit
Comprehension
Comprehension
Compress
Compress
CompressColumnConstraint
CompressColumnConstraint
ComputedColumn
Computed/generated column constraint
ComputedColumnConstraint
ComputedColumnConstraint
ConcatWs
CONCAT_WS function
ConditionalInsert
ConditionalInsert
Connect
Oracle CONNECT BY clause for hierarchical queries
ConnectByRoot
Oracle CONNECT_BY_ROOT function - returns root row’s column value
Constraint
Constraint
ConstraintModifiers
Constraint modifiers (shared between table-level constraints)
ConvertFunc
CONVERT function (SQL Server style)
ConvertTimezone
ConvertTimezone
ConvertToCharset
ConvertToCharset
CopyParameter
COPY parameter (e.g., FILE_FORMAT = CSV or FORMAT PARQUET)
CopyStmt
COPY statement (Snowflake, PostgreSQL, DuckDB, TSQL)
Corr
Corr
CosineDistance
CosineDistance
CountFunc
COUNT function with optional star
CovarPop
CovarPop
CovarSamp
CovarSamp
CreateDatabase
CREATE DATABASE statement
CreateFunction
CREATE FUNCTION statement
CreateIndex
CREATE INDEX statement
CreateProcedure
CREATE PROCEDURE statement
CreateSchema
CREATE SCHEMA statement
CreateSequence
CREATE SEQUENCE statement
CreateTable
CREATE TABLE statement
CreateTrigger
CREATE TRIGGER statement
CreateType
CREATE TYPE statement
CreateView
CREATE VIEW statement
Credentials
Credentials for external access (S3, Azure, etc.)
CredentialsProperty
CredentialsProperty
Cte
Represent a single Common Table Expression definition.
Cube
Cube
CumeDist
CUME_DIST function (DuckDB allows ORDER BY inside, Oracle allows hypothetical args with WITHIN GROUP)
CurrentDate
CURRENT_DATE (no arguments)
CurrentDatetime
CurrentDatetime
CurrentSchema
CurrentSchema
CurrentSchemas
CurrentSchemas
CurrentTime
CURRENT_TIME
CurrentTimestamp
CURRENT_TIMESTAMP
CurrentTimestampLTZ
CURRENT_TIMESTAMP_LTZ - Snowflake local timezone timestamp
CurrentUser
CurrentUser
DPipe
DPipe
DataBlocksizeProperty
DataBlocksizeProperty
DataDeletionProperty
DataDeletionProperty
DateAddFunc
DATE_ADD / DATE_SUB function
DateBin
DateBin
DateDiffFunc
DATEDIFF function
DateFormatColumnConstraint
DateFormatColumnConstraint
DateFormatFunc
DATE_FORMAT / FORMAT_DATE function
DateFromParts
DateFromParts
DateTruncFunc
DATE_TRUNC function
Datetime
Datetime
DatetimeAdd
DatetimeAdd
DatetimeDiff
DatetimeDiff
DatetimeSub
DatetimeSub
DatetimeTrunc
DatetimeTrunc
Dayname
Dayname
Declare
Declare
DeclareItem
DeclareItem
DecodeCase
DecodeCase
DecodeFunc
DECODE function (Oracle style)
DecompressBinary
DecompressBinary
DecompressString
DecompressString
Decrypt
Decrypt
DecryptRaw
DecryptRaw
DefaultColumnConstraint
DefaultColumnConstraint - DEFAULT value for a column
DefinerProperty
DefinerProperty
Delete
DELETE statement
DenseRank
DENSE_RANK function (Oracle allows hypothetical args with WITHIN GROUP)
Describe
DESCRIBE statement - shows table structure or query plan
Detach
Detach
DictProperty
DictProperty
DictRange
DictRange
Directory
Directory
DirectoryInsert
Directory insert for INSERT OVERWRITE DIRECTORY (Hive/Spark)
DistKeyProperty
DistKeyProperty
DistStyleProperty
DistStyleProperty
DistributeBy
DISTRIBUTE BY clause (Hive/Spark) Controls how rows are distributed across reducers
DistributedByProperty
DistributedByProperty
DomainConstraint
Domain constraint
DotAccess
Dot access (struct.field)
DotProduct
DotProduct
DropDatabase
DROP DATABASE statement
DropFunction
DROP FUNCTION statement
DropIndex
DROP INDEX statement
DropNamespace
DROP NAMESPACE statement (Spark/Databricks - alias for DROP SCHEMA)
DropPartition
DropPartition
DropProcedure
DROP PROCEDURE statement
DropSchema
DROP SCHEMA statement
DropSequence
DROP SEQUENCE statement
DropTable
DROP TABLE statement
DropTrigger
DROP TRIGGER statement
DropType
DROP TYPE statement
DropView
DROP VIEW statement
DuplicateKeyProperty
DuplicateKeyProperty
Elt
Elt
Encode
Encode
EncodeProperty
EncodeProperty
Encrypt
Encrypt
EncryptRaw
EncryptRaw
EngineProperty
EngineProperty
EnviromentProperty
EnviromentProperty
EphemeralColumnConstraint
EphemeralColumnConstraint
EqualNull
EqualNull
EuclideanDistance
EuclideanDistance
Except
Represent an EXCEPT (MINUS) set operation between two query expressions.
ExcludeElement
Element in an EXCLUDE constraint: expression WITH operator
ExecuteAsProperty
ExecuteAsProperty
ExecuteParameter
Named parameter in EXEC statement: @name=value
ExecuteStatement
EXEC/EXECUTE statement (TSQL stored procedure call) Syntax: EXEC [schema.]procedure_name [@param=value, …]
Exists
Represent an EXISTS predicate (EXISTS (SELECT ...) or NOT EXISTS (...)).
Export
Export
ExternalProperty
ExternalProperty
ExtractFunc
EXTRACT function
FallbackProperty
FallbackProperty
FarmFingerprint
FarmFingerprint
FeaturesAtTime
FeaturesAtTime
Fetch
FETCH FIRST/NEXT clause (SQL standard)
FileFormatProperty
FileFormatProperty
Filter
Filter
Float64
Float64
FloorFunc
FLOOR function with optional scale and time unit (Druid: FLOOR(time TO unit))
ForIn
ForIn
ForeignKey
ForeignKey
ForeignKeyRef
Foreign key reference
Format
Format
FormatPhrase
Format override for a column in Teradata
FreespaceProperty
FreespaceProperty
From
Represent the FROM clause of a SELECT statement.
FromBase
FromBase
FromTimeZone
FromTimeZone
FromUnixtimeFunc
FROM_UNIXTIME function
Function
Represent a scalar function call (e.g. UPPER(name), COALESCE(a, b)).
FunctionParameter
Function parameter
FunctionSetOption
A SET option in CREATE FUNCTION (PostgreSQL)
GapFill
GapFill
GenerateDateArray
GenerateDateArray
GenerateEmbedding
GenerateEmbedding
GenerateSeries
GenerateSeries
GenerateTimestampArray
GenerateTimestampArray
GeneratedAsIdentity
Generated identity column constraint
GeneratedAsIdentityColumnConstraint
GeneratedAsIdentityColumnConstraint
GeneratedAsRow
TSQL temporal column constraint: GENERATED ALWAYS AS ROW START|END [HIDDEN]
GeneratedAsRowColumnConstraint
GeneratedAsRowColumnConstraint
Get
Get
GetExtract
GetExtract
Getbit
Getbit
Grant
GRANT statement
GrantPrincipal
Principal in GRANT/REVOKE (user, role, etc.)
GrantPrivilege
GrantPrivilege
Group
Group
GroupBy
Represent a GROUP BY clause with optional ALL/DISTINCT and WITH TOTALS modifiers.
GroupConcatFunc
GROUP_CONCAT function (MySQL style)
Grouping
Grouping
GroupingId
GroupingId
GroupingSets
GroupingSets
HashAgg
HashAgg
Having
Represent a HAVING clause containing a predicate over aggregate results.
HavingMax
HavingMax
Heredoc
Heredoc
HexEncode
HexEncode
HexStringExpr
HexStringExpr - Hex string expression (not literal) BigQuery: converts to FROM_HEX(this)
Hint
Query hint
HistoricalData
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) or x IN (SELECT ...)).
InOutColumnConstraint
InOutColumnConstraint
IncludeProperty
IncludeProperty
Index
Index
IndexColumn
Index column specification
IndexColumnConstraint
IndexColumnConstraint
IndexConstraintOption
IndexConstraintOption
IndexParameters
IndexParameters
IndexTableHint
IndexTableHint
InheritsProperty
InheritsProperty
InputModelProperty
InputModelProperty
InputOutputFormat
InputOutputFormat
Insert
INSERT statement
Install
Install
Intersect
Represent an INTERSECT set operation between two query expressions.
Interval
Interval expression
IntervalOp
IntervalOp
IntervalSpan
Interval span for ranges like HOUR TO SECOND
IntervalSpanExpr
Expression-based interval span for Oracle (e.g., DAY(9) TO SECOND(3)) Unlike IntervalSpan, this uses expressions to represent units with optional precision
IntoClause
Into
Introducer
Introducer
IsJson
IS JSON predicate (SQL standard) Checks if a value is valid JSON
IsNull
IS NULL predicate
IsTrueFalse
IS TRUE / IS FALSE predicate
IsolatedLoadingProperty
IsolatedLoadingProperty
JSON
JSON
JSONArray
JSONArray
JSONArrayAgg
JSONArrayAgg
JSONArrayAppend
JSONArrayAppend
JSONArrayContains
JSONArrayContains
JSONArrayInsert
JSONArrayInsert
JSONBExists
JSONBExists
JSONBExtractScalar
JSONBExtractScalar
JSONBObjectAgg
JSONBObjectAgg
JSONCast
JSONCast
JSONColumnDef
JSONColumnDef
JSONExists
JSONExists
JSONExtract
JSONExtract
JSONExtractArray
JSONExtractArray
JSONExtractQuote
JSONExtractQuote
JSONExtractScalar
JSONExtractScalar
JSONFormat
JSONFormat
JSONKeyValue
JSONKeyValue
JSONKeys
JSONKeys
JSONKeysAtDepth
JSONKeysAtDepth
JSONObject
JSONObject
JSONObjectAgg
JSONObjectAgg
JSONPath
JSONPath
JSONPathFilter
JSONPathFilter
JSONPathKey
JSONPathKey
JSONPathRecursive
JSONPathRecursive
JSONPathRoot
JSONPathRoot - Represents $ in JSON path expressions
JSONPathScript
JSONPathScript
JSONPathSelector
JSONPathSelector
JSONPathSlice
JSONPathSlice
JSONPathSubscript
JSONPathSubscript
JSONPathUnion
JSONPathUnion
JSONRemove
JSONRemove
JSONSchema
JSONSchema
JSONSet
JSONSet
JSONStripNulls
JSONStripNulls
JSONTable
JSONTable
JSONType
JSONType
JSONValue
JSONValue
JSONValueArray
JSONValueArray
JarowinklerSimilarity
JarowinklerSimilarity
Join
Represent a JOIN clause between two table sources.
JoinHint
JoinHint
JoinedTable
Parenthesized table expression with joins Represents: (tbl1 CROSS JOIN tbl2) or ((SELECT 1) CROSS JOIN (SELECT 2))
JournalProperty
JournalProperty
JsonArrayAggFunc
JSON_ARRAYAGG function
JsonExtractFunc
JSON_EXTRACT / JSON_EXTRACT_SCALAR function
JsonModifyFunc
JSON_SET / JSON_INSERT function
JsonObjectAggFunc
JSON_OBJECTAGG function
JsonObjectFunc
JSON_OBJECT function
JsonPathFunc
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]
LambdaExpr
Lambda expression
LanguageProperty
LanguageProperty
LastDayFunc
LAST_DAY function with optional date part (for BigQuery granularity like WEEK(SUNDAY))
Lateral
Lateral
LateralView
LATERAL VIEW clause (Hive/Spark) Used for unnesting arrays/maps with EXPLODE, POSEXPLODE, etc.
LeadLagFunc
LEAD / LAG function
LeftRightFunc
LEFT/RIGHT function
LikeOp
LIKE/ILIKE operation with optional ESCAPE clause and quantifier (ANY/ALL)
LikeProperty
LikeProperty
Limit
Represent a LIMIT clause that restricts the number of returned rows.
LimitOptions
LimitOptions
List
List
ListAggFunc
LISTAGG function (Oracle style)
LoadData
LOAD DATA statement (Hive)
Localtime
Localtime
Localtimestamp
Localtimestamp
LocationProperty
LocationProperty
Lock
Lock
LockProperty
LockProperty
LockingProperty
LockingProperty
LockingStatement
LockingStatement
LogFunc
LOG function
LogProperty
LogProperty
MD5Digest
MD5Digest
MLForecast
MLForecast
MLTranslate
MLTranslate
MakeDateFunc
MAKE_DATE function
MakeInterval
MakeInterval
MakeTimestampFunc
MAKE_TIMESTAMP function
ManhattanDistance
ManhattanDistance
Map
Map
MapCat
MapCat
MapConstructor
MAP constructor
MapDelete
MapDelete
MapInsert
MapInsert
MapPick
MapPick
MaskingPolicyColumnConstraint
MaskingPolicyColumnConstraint
MatchAgainst
MatchAgainst
MatchRecognize
MATCH_RECOGNIZE clause for row pattern matching (Oracle/Snowflake/Presto/Trino)
MatchRecognizeMeasure
MEASURES expression with optional RUNNING/FINAL semantics
MaterializedProperty
MaterializedProperty
Merge
Merge
MergeBlockRatioProperty
MergeBlockRatioProperty
MergeTreeTTL
MergeTreeTTL
MergeTreeTTLAction
MergeTreeTTLAction
MethodCall
Method call (expr.method(args))
Minhash
Minhash
ModelAttribute
ModelAttribute
Monthname
Monthname
MultitableInserts
MultitableInserts
NTileFunc
NTILE function (DuckDB allows ORDER BY inside)
NamedArgument
Named argument in function call: name => value or name := value
NamedStructFunc
NAMED_STRUCT function
NamedWindow
Named window definition (WINDOW w AS (…))
NextValueFor
NextValueFor
Normal
Normal
Normalize
Normalize
NotNullColumnConstraint
NotNullColumnConstraint
NthValueFunc
NTH_VALUE function
Ntile
Ntile
Null
NULL literal
Nullif
Nullif
NumberToStr
NumberToStr
Nvl2Func
NVL2 function
ObjectAgg
ObjectAgg
ObjectIdentifier
ObjectIdentifier
ObjectInsert
ObjectInsert
Offset
OFFSET clause
OnCluster
OnCluster
OnCommitProperty
OnCommitProperty
OnCondition
OnCondition
OnConflict
OnConflict
OnProperty
OnProperty
Opclass
Opclass
OpenJSON
OpenJSON
OpenJSONColumnDef
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.
OutputClause
OUTPUT clause (TSQL) - used in INSERT, UPDATE, DELETE
OutputModelProperty
OutputModelProperty
Over
OVER clause
OverflowTruncateBehavior
OverflowTruncateBehavior
OverlapsExpr
OVERLAPS expression Supports two forms:
OverlayFunc
OVERLAY function - OVERLAY(string PLACING replacement FROM position [FOR length])
Pad
Pad
PadFunc
LPAD/RPAD function
Parameter
Parameter (parameterized queries)
ParameterizedAgg
ParameterizedAgg
Paren
Represent an explicit parenthesized expression for grouping precedence.
ParseDatetime
ParseDatetime
ParseIp
ParseIp
ParseJSON
ParseJSON
ParseTime
ParseTime
ParseUrl
ParseUrl
Partition
Partition - represents PARTITION/SUBPARTITION clause
PartitionBoundSpec
PartitionBoundSpec
PartitionByListProperty
PartitionByListProperty
PartitionByRangeProperty
PartitionByRangeProperty
PartitionByRangePropertyDynamic
PartitionByRangePropertyDynamic
PartitionByTruncate
PartitionByTruncate
PartitionList
PartitionList
PartitionRange
PartitionRange
PartitionedByBucket
PartitionedByBucket
PartitionedByProperty
PartitionedByProperty
PartitionedOfProperty
PartitionedOfProperty
PathColumnConstraint
PathColumnConstraint - PATH ‘xpath’ for XMLTABLE/JSON_TABLE columns
PercentRank
PERCENT_RANK function (DuckDB allows ORDER BY inside, Oracle allows hypothetical args with WITHIN GROUP)
PercentileFunc
PERCENTILE_CONT / PERCENTILE_DISC function
PeriodForSystemTimeConstraint
PeriodForSystemTimeConstraint
Pi
PI function (no arguments)
Pivot
PIVOT operation - supports both standard and DuckDB simplified syntax
PivotAlias
PIVOT alias for aliasing pivot expressions The alias can be an identifier or an expression (for Oracle/BigQuery string concatenation aliases)
PivotAny
PivotAny
Placeholder
Placeholder expression
PositionFunc
POSITION/INSTR function
Pragma
PRAGMA statement (SQLite)
PreWhere
PREWHERE clause (ClickHouse) - early filtering before WHERE
Predict
Predict
PreviousDay
PreviousDay
PrimaryKey
PrimaryKey
PrimaryKeyColumnConstraint
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)
ProjectionDef
ProjectionDef
Properties
Properties
Property
Property
PseudoType
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.
QuantifiedExpr
ANY / ALL quantified expression
Quantile
Quantile
QueryBand
QueryBand
QueryOption
QueryOption
QueryTransform
QueryTransform
Rand
RAND function (optional seed, or Teradata RANDOM(lower, upper))
Randn
Randn
Random
RANDOM function (no arguments)
Randstr
Randstr
RangeBucket
RangeBucket
RangeN
RangeN
Rank
RANK function (DuckDB allows ORDER BY inside, Oracle allows hypothetical args with WITHIN GROUP)
Raw
Raw/unparsed SQL
ReadCSV
ReadCSV
ReadParquet
ReadParquet
RecursiveWithSearch
RecursiveWithSearch
Reduce
Reduce
Reference
Reference
Refresh
Refresh
RefreshTriggerProperty
RefreshTriggerProperty - Doris REFRESH clause for materialized views e.g., REFRESH COMPLETE ON MANUAL, REFRESH AUTO ON SCHEDULE EVERY 5 MINUTE
RegexpCount
RegexpCount
RegexpExtractAll
RegexpExtractAll
RegexpExtractFunc
REGEXP_EXTRACT function
RegexpFullMatch
RegexpFullMatch
RegexpFunc
REGEXP_LIKE function
RegexpILike
RegexpILike
RegexpInstr
RegexpInstr
RegexpReplaceFunc
REGEXP_REPLACE function
RegexpSplit
RegexpSplit
RegrAvgx
RegrAvgx
RegrAvgy
RegrAvgy
RegrCount
RegrCount
RegrIntercept
RegrIntercept
RegrR2
RegrR2
RegrSlope
RegrSlope
RegrSxx
RegrSxx
RegrSxy
RegrSxy
RegrSyy
RegrSyy
RegrValx
RegrValx
RegrValy
RegrValy
RemoteWithConnectionModelProperty
RemoteWithConnectionModelProperty
RenameColumn
RenameColumn
RepeatFunc
REPEAT function
ReplaceFunc
REPLACE function
ReplacePartition
ReplacePartition
Returning
Returning
ReturnsProperty
ReturnsProperty
Revoke
REVOKE statement
Rollback
Rollback
Rollup
Rollup
RollupIndex
RollupIndex - A single rollup index: name(col1, col2)
RollupProperty
RollupProperty - StarRocks ROLLUP (index_name(col1, col2), …)
RoundFunc
ROUND function
RowFormat
ROW FORMAT clause for Hive/Spark
RowFormatDelimitedProperty
RowFormatDelimitedProperty
RowFormatProperty
RowFormatProperty
RowFormatSerdeProperty
RowFormatSerdeProperty
RowNumber
ROW_NUMBER function (no arguments)
RowsFrom
RowsFrom - PostgreSQL ROWS FROM (func1(args) AS alias1(…), func2(args) AS alias2(…)) syntax Used for set-returning functions with typed column definitions
SHA2
SHA2
SHA2Digest
SHA2Digest
SafeAdd
SafeAdd
SafeDivide
SafeDivide
SafeMultiply
SafeMultiply
SafeSubtract
SafeSubtract
Sample
SAMPLE / TABLESAMPLE clause
SampleProperty
SampleProperty
Schema
Schema
SchemaCommentProperty
SchemaCommentProperty
ScopeResolution
ScopeResolution
Search
Search
SearchIp
SearchIp
SecurityProperty
SecurityProperty
Select
Represent a complete SELECT statement.
SelectInto
INTO clause for SELECT INTO statements
SemanticView
SemanticView
SequenceFunc
SEQUENCE / GENERATE_SERIES function
SequenceProperties
SequenceProperties
SerdeProperties
SerdeProperties
SessionParameter
SessionParameter
SessionUser
SessionUser - MySQL/PostgreSQL SESSION_USER function
Set
Set
SetConfigProperty
SetConfigProperty
SetItem
A single SET item (variable assignment)
SetOperation
SetOperation
SetProperty
SetProperty
SetStatement
SET variable statement
SettingsProperty
SettingsProperty
SharingProperty
SharingProperty
Show
SHOW statement - displays database objects
SimilarToExpr
SIMILAR TO expression
Slice
Slice
SortArray
SortArray
SortBy
SORT BY clause (Hive/Spark) Sorts data within each reducer (local sort, not global)
SortKeyProperty
SortKeyProperty
SplitFunc
SPLIT function
SplitPart
SplitPart
SqlComment
SQL Comment preservation
SqlReadWriteProperty
SqlReadWriteProperty
SqlSecurityProperty
SqlSecurityProperty
StDistance
StDistance
StPoint
StPoint
StabilityProperty
StabilityProperty
StageReference
Stage reference (Snowflake) - @stage_name or @namespace.stage/path
StandardHash
StandardHash
Star
Represent a wildcard star expression (*, table.*).
StorageHandlerProperty
StorageHandlerProperty
StrPosition
StrPosition
StrToDate
StrToDate
StrToMap
StrToMap
StrToTime
StrToTime
StrToUnix
StrToUnix
Stream
STREAM definition (Snowflake) - for change data capture
StringAggFunc
STRING_AGG function (PostgreSQL/Standard SQL)
StringFunc
StringFunc - String type conversion function (BigQuery STRING)
StringToArray
StringToArray
Struct
Struct expression
StructConstructor
STRUCT constructor
StructExtractFunc
STRUCT_EXTRACT function
StructField
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])
SubstringFunc
SUBSTRING function
SubstringIndex
SUBSTRING_INDEX(str, delim, count)
SumIfFunc
SUM_IF / COUNT_IF function
Summarize
Summarize
Systimestamp
Systimestamp
TableAlias
TableAlias
TableArgument
TABLE ref or MODEL ref used as a function argument (BigQuery) e.g., GAP_FILL(TABLE device_data, …) or ML.PREDICT(MODEL mydataset.mymodel, …)
TableFromRows
TableFromRows
TableRef
Represent a table reference with optional schema and catalog qualifiers.
TableSample
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
TemporaryProperty
TemporaryProperty
TeradataIndex
Teradata index specification for CREATE TABLE
TimeAdd
TimeAdd
TimeDiff
TimeDiff
TimeFromParts
TimeFromParts
TimeSlice
TimeSlice
TimeStrToTime
TimeStrToTime
TimeSub
TimeSub
TimeToStr
TimeToStr
TimeTrunc
TimeTrunc
TimeUnit
Automatically converts unit arg into a var.
TimestampAdd
TimestampAdd
TimestampDiff
TimestampDiff
TimestampFromParts
TimestampFromParts
TimestampFunc
TimestampFunc - TIMESTAMP constructor function
TimestampSub
TimestampSub
TimestampTzFromParts
TimestampTzFromParts
ToBinary
ToBinary
ToBoolean
ToBoolean
ToChar
ToChar
ToDateFunc
TO_DATE function
ToDecfloat
ToDecfloat
ToDouble
ToDouble
ToFile
ToFile
ToMap
ToMap - Materialize-style map constructor Can hold either:
ToNumber
ToNumber
ToTableProperty
ToTableProperty
ToTimestampFunc
TO_TIMESTAMP function
Top
TOP clause (SQL Server)
Transaction
Transaction
Transform
Transform
TransformFunc
TRANSFORM_KEYS / TRANSFORM_VALUES function
TransformModelProperty
TransformModelProperty
TransientProperty
TransientProperty
Translate
Translate
TranslateCharacters
TranslateCharacters
TriggerReferencing
Trigger REFERENCING clause
TrimFunc
TRIM function
Truncate
TRUNCATE TABLE statement
TruncateFunc
TRUNCATE / TRUNC function
TruncateTable
TruncateTable
TruncateTableEntry
A table entry in a TRUNCATE statement, with optional ONLY modifier and * suffix
TryBase64DecodeBinary
TryBase64DecodeBinary
TryBase64DecodeString
TryBase64DecodeString
TryToDecfloat
TryToDecfloat
TsOrDsAdd
TsOrDsAdd
TsOrDsDiff
TsOrDsDiff
TsOrDsToDate
TsOrDsToDate
TsOrDsToTime
TsOrDsToTime
Tuple
Tuple expression
TypeAttribute
Type attribute for composite types
UnaryFunc
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
UnicodeString
UnicodeString
Uniform
Uniform
Union
Represent a UNION set operation between two query expressions.
UniqueColumnConstraint
UniqueColumnConstraint
UniqueKeyProperty
UniqueKeyProperty
UnixTimestampFunc
UNIX_TIMESTAMP function
UnixToStr
UnixToStr
UnixToTime
UnixToTime
UnnestFunc
UNNEST function
Unpivot
UNPIVOT operation
UnpivotColumns
UnpivotColumns
Update
UPDATE statement
Use
USE statement (USE database, USE ROLE, USE WAREHOUSE, USE CATALOG, USE SCHEMA)
UserDefinedFunction
UserDefinedFunction
UsingData
USING DATA clause for data import statements
UsingTemplateProperty
UsingTemplateProperty
UtcTime
UtcTime
UtcTimestamp
UtcTimestamp
Uuid
Uuid
ValueFunc
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)
VarArgFunc
Variable argument function
VarMap
VarMap
VectorSearch
VectorSearch
Version
Version
ViewAttributeProperty
ViewAttributeProperty
ViewColumn
View column definition with optional COMMENT and OPTIONS (BigQuery)
VolatileProperty
VolatileProperty
WatermarkColumnConstraint
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.
WidthBucket
WidthBucket
WindowFrame
Window frame
WindowFunction
Represent a window function call with its OVER clause.
WindowSpec
Window specification
With
Represent a WITH clause containing one or more Common Table Expressions (CTEs).
WithDataProperty
WithDataProperty
WithFill
WithFill
WithJournalTableProperty
WithJournalTableProperty
WithOperator
WithOperator
WithProcedureOptions
WithProcedureOptions
WithSchemaBindingProperty
WithSchemaBindingProperty
WithSystemVersioningProperty
WithSystemVersioningProperty
WithTableHint
WithTableHint
WithinGroup
WITHIN GROUP clause (for ordered-set aggregate functions)
XMLElement
XMLElement
XMLGet
XMLGet
XMLKeyValueOption
XMLKeyValueOption
XMLTable
XMLTable
XmlNamespace
XML Namespace declaration
Xor
Xor
Zipf
Zipf

Enums§

AlterColumnAction
Actions for ALTER COLUMN
AlterIndexAction
Actions for ALTER INDEX
AlterTableAction
Actions for ALTER TABLE
AlterViewAction
Actions for ALTER VIEW
ColumnConstraint
Column-level constraint
ColumnPosition
Column position for ADD COLUMN (MySQL/MariaDB)
ConstraintType
Type of column constraint for tracking order
DataType
Enumerate all SQL data types recognized by the parser.
DatabaseOption
Database option
DateTimeField
Expression
Represent any SQL expression or statement as a single, recursive AST node.
FunctionBody
Function body
FunctionPropertyKind
Types of properties in CREATE FUNCTION for tracking their original order
FunctionSecurity
Function security (DEFINER, INVOKER, or NONE)
FunctionSetValue
The value of a SET option
HintExpression
Individual hint expression
IntervalUnit
IntervalUnitSpec
Specification for interval unit - can be a simple unit, a span (HOUR TO SECOND), or an expression
JoinKind
Enumerate all supported SQL join types.
JsonNullHandling
JSON null handling options
JsonUniqueKeys
JSON unique keys constraint variants
LikeOptionAction
Action for LIKE clause options
ListAggOverflow
LISTAGG ON OVERFLOW behavior
Literal
Represent a SQL literal value.
MatchRecognizeAfter
AFTER MATCH SKIP behavior
MatchRecognizeRows
Row output semantics for MATCH_RECOGNIZE
MatchRecognizeSemantics
Semantics for MEASURES in MATCH_RECOGNIZE
MatchType
MATCH type for foreign keys
NamedArgSeparator
Separator style for named arguments
OnCommit
ON COMMIT behavior for temporary tables
ParameterMode
Parameter mode (IN, OUT, INOUT)
ParameterStyle
Parameter placeholder styles
PseudocolumnType
Pseudocolumn type
QuantifiedOp
Comparison operator for quantified expressions
ReferentialAction
Referential action for foreign keys
SampleMethod
Sample method
SeqPropKind
Sequence property tag for ordering
SequenceBound
Sequence bound (value or NO MINVALUE/NO MAXVALUE)
SortOrder
Sort order for PRIMARY KEY ASC/DESC
SqlDataAccess
SQL data access characteristics for functions
TableConstraint
Table-level constraint
TeradataIndexKind
Kind of Teradata index
TriggerBody
Trigger body
TriggerEvent
Trigger event (INSERT, UPDATE, DELETE, TRUNCATE)
TriggerForEach
Trigger FOR EACH clause
TriggerTiming
Trigger timing (BEFORE, AFTER, INSTEAD OF)
TrimPosition
TruncateIdentity
TRUNCATE identity option
TruncateTarget
TRUNCATE target type
TypeDefinition
Type definition
UseKind
Kind of USE statement
WindowFrameBound
WindowFrameExclude
EXCLUDE clause for window frames
WindowFrameKind