BNF for SQLPP.jj

TOKENS

   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
   
<DEFAULT,IN_DBL_BRACE> TOKEN [IGNORE_CASE] : {
<ADAPTER: "adapter">
| <ALL: "all">
| <ANALYZE: "analyze">
| <AND: "and">
| <ANY: "any">
| <APPLY: "apply">
| <AS: "as">
| <ASC: "asc">
| <AT: "at">
| <AUTOGENERATED: "autogenerated">
| <BETWEEN: "between">
| <BTREE: "btree">
| <BY: "by">
| <CASE: "case">
| <CAST: "cast">
| <CLOSED: "closed">
| <CREATE: "create">
| <CROSS: "cross">
| <COMPACTION: "compaction">
| <COMPACT: "compact">
| <CONNECT: "connect">
| <CORRELATE: "correlate">
| <DATASET: "dataset">
| <COLLECTION: "collection">
| <DATABASE: "database">
| <DATAVERSE: "dataverse">
| <DECLARE: "declare">
| <DEFINITION: "definition">
| <DELETE: "delete">
| <DESC: "desc">
| <DISCONNECT: "disconnect">
| <DISTINCT: "distinct">
| <DIV: "div">
| <DROP: "drop">
| <ELEMENT: "element">
| <EXPLAIN: "explain">
| <ELSE: "else">
| <ENFORCED: "enforced">
| <END: "end">
| <EVERY: "every">
| <EXCEPT: "except">
| <EXISTS: "exists">
| <EXTERNAL: "external">
| <FALSE: "false">
| <FEED: "feed">
| <FILTER: "filter">
| <FLATTEN: "flatten">
| <FOR: "for">
| <FROM: "from">
| <FULL: "full">
| <FULLTEXT: "fulltext">
| <FUNCTION: "function">
| <GROUP: "group">
| <HAVING: "having">
| <HINTS: "hints">
| <IF: "if">
| <INTO: "into">
| <IN: "in">
| <INDEX: "index">
| <INGESTION: "ingestion">
| <INNER: "inner">
| <INSERT: "insert">
| <INTERNAL: "internal">
| <INTERSECT: "intersect">
| <IS: "is">
| <JOIN: "join">
| <KEYWORD: "keyword">
| <KEY: "key">
| <KNOWN: "known">
| <LEFT: "left">
| <LETTING: "letting">
| <LET: "let">
| <LIKE: "like">
| <LIMIT: "limit">
| <LOAD: "load">
| <MISSING: "missing">
| <MOD: "mod">
| <NODEGROUP: "nodegroup">
| <NGRAM: "ngram">
| <NOT: "not">
| <NULL: "null">
| <OFFSET: "offset">
| <ON: "on">
| <OPEN: "open">
| <OR: "or">
| <ORDER: "order">
| <OUTER: "outer">
| <OUTPUT: "output">
| <OVER: "over">
| <PATH: "path">
| <POLICY: "policy">
| <PRESORTED: "pre-sorted">
| <PRIMARY: "primary">
| <RAW: "raw">
| <RETURN: "return">
| <RETURNING: "returning">
| <RIGHT: "right">
| <RTREE: "rtree">
| <RUN: "run">
| <SATISFIES: "satisfies">
| <SECONDARY: "secondary">
| <SELECT: "select">
| <SET: "set">
| <SOME: "some">
| <START: "start">
| <STOP: "stop">
| <SYNONYM: "synonym">
| <TEMPORARY: "temporary">
| <THEN: "then">
| <TO: "to">
| <TRUE: "true">
| <TYPE: "type">
| <UNION: "union">
| <UNKNOWN: "unknown">
| <UNNEST: "unnest">
| <UPDATE: "update">
| <UPSERT: "upsert">
| <USE: "use">
| <USING: "using">
| <VALUE: "value">
| <VALUED: "valued">
| <VIEW: "view">
| <WHEN: "when">
| <WHERE: "where">
| <WITH: "with">
| <WRITE: "write">
| <COPY: "copy">
}

   
<DEFAULT,IN_DBL_BRACE> TOKEN : {
<CARET: "^">
| <CONCAT: "||">
| <DIVIDE: "/">
| <MINUS: "-">
| <MUL: "*">
| <PLUS: "+">
| <LEFTPAREN: "(">
| <RIGHTPAREN: ")">
| <LEFTBRACKET: "[">
| <RIGHTBRACKET: "]">
| <ATT: "@">
| <COLON: ":">
| <COMMA: ",">
| <DOT: ".">
| <PERCENT: "%">
| <QUES: "?">
| <SEMICOLON: ";">
| <SHARP: "#">
| <LT: "<">
| <GT: ">">
| <LE: "<=">
| <GE: ">=">
| <EQ: "=">
| <NE: "!=">
| <LG: "<>">
| <SIMILAR: "~=">
}

   
<DEFAULT,IN_DBL_BRACE> TOKEN : {
<LEFTBRACE: "{"> : DEFAULT
}

   
<DEFAULT> TOKEN : {
<RIGHTBRACE: "}"> : {
}

   
<DEFAULT,IN_DBL_BRACE> TOKEN : {
<LEFTDBLBRACE: "{{"> : IN_DBL_BRACE
}

   
<IN_DBL_BRACE> TOKEN : {
<RIGHTDBLBRACE: "}}"> : {
}

   
<DEFAULT,IN_DBL_BRACE> TOKEN : {
<#DIGIT: ["0"-"9"]>
}

   
<DEFAULT,IN_DBL_BRACE> TOKEN : {
<INTEGER_LITERAL: <DIGITS>>
| <DOUBLE_LITERAL: <DIGITS> "." <DIGITS> (("e" | "E") ("+" | "-")? <DIGITS>)? | <DIGITS> ("e" | "E") ("+" | "-")? <DIGITS> | "." <DIGITS> (("e" | "E") ("+" | "-")? <DIGITS>)?>
| <FLOAT_LITERAL: <DIGITS> ("f" | "F") | <DIGITS> ("." <DIGITS> ("f" | "F"))? | "." <DIGITS> ("f" | "F")>
| <#DIGITS: (<DIGIT>)+>
}

   
<DEFAULT,IN_DBL_BRACE> TOKEN : {
<#LETTER: ["A"-"Z","a"-"z"]>
| <#IDENTIFIER_START_SPECIALCHAR: ["_"]>
| <#IDENTIFIER_REST_SPECIALCHAR: ["$"]>
| <#IDENTIFIER_START: <LETTER> | <IDENTIFIER_START_SPECIALCHAR>>
| <#IDENTIFIER_REST: <LETTER> | <DIGIT> | <IDENTIFIER_START_SPECIALCHAR> | <IDENTIFIER_REST_SPECIALCHAR>>
| <IDENTIFIER: <IDENTIFIER_START> (<IDENTIFIER_REST>)*>
}

   
<DEFAULT,IN_DBL_BRACE> TOKEN : {
<QUOTED_STRING: "`" (<EscapeQuot> | <EscapeBslash> | <EscapeSlash> | <EscapeBspace> | <EscapeFormf> | <EscapeNl> | <EscapeCr> | <EscapeTab> | <EscapeBTickWithBslash> | <EscapeBtickWithBtick> | ~["`","\\"])* "`">
| <STRING_LITERAL: ("E")? "\"" (<EscapeQuot> | <EscapeBslash> | <EscapeSlash> | <EscapeBspace> | <EscapeFormf> | <EscapeNl> | <EscapeBTickWithBslash> | <EscapeCr> | <EscapeTab> | ~["\"","\\"])* "\"" | ("E")? "\'" (<EscapeApos> | <EscapeBslash> | <EscapeSlash> | <EscapeBspace> | <EscapeFormf> | <EscapeNl> | <EscapeBTickWithBslash> | <EscapeCr> | <EscapeTab> | ~["\'","\\"])* "\'">
| <#EscapeBTickWithBslash: "\\`">
| <#EscapeBtickWithBtick: "``">
| <#EscapeQuot: "\\\"">
| <#EscapeApos: "\\\'">
| <#EscapeBslash: "\\\\">
| <#EscapeSlash: "\\/">
| <#EscapeBspace: "\\b">
| <#EscapeFormf: "\\f">
| <#EscapeNl: "\\n">
| <#EscapeCr: "\\r">
| <#EscapeTab: "\\t">
}

   
<DEFAULT,IN_DBL_BRACE> TOKEN : {
<DOLLAR_INTEGER_LITERAL: "$" <INTEGER_LITERAL>>
| <DOLLAR_IDENTIFIER: "$" <IDENTIFIER>>
| <DOLLAR_QUOTED_STRING: "$" <QUOTED_STRING>>
}

   
<DEFAULT,IN_DBL_BRACE> SKIP : {
" "
| "\t"
| "\r"
| "\n"
}

   
<DEFAULT,IN_DBL_BRACE> SKIP : {
<"//" (~["\n"])* "\n">
}

   
<DEFAULT,IN_DBL_BRACE> SKIP : {
<"//" (~["\n","\r"])* ("\n" | "\r" | "\r\n")?>
}

   
<DEFAULT,IN_DBL_BRACE> SKIP : {
<"--" (~["\n"])* "\n">
}

   
<DEFAULT,IN_DBL_BRACE> SKIP : {
<"--" (~["\n","\r"])* ("\n" | "\r" | "\r\n")?>
}

   
<DEFAULT,IN_DBL_BRACE> SKIP : {
"/*" : INSIDE_COMMENT
}

   
<INSIDE_COMMENT> SPECIAL : {
<"+" (" ")* (~["*"])*>
}

   
<INSIDE_COMMENT> SKIP : {
"/*" : {
}

   
<INSIDE_COMMENT> SKIP : {
"*/" : {
| <~[]>
}

   

NON-TERMINALS

Statement ::= ( ( ExplainStatement )? ( <SEMICOLON> )+ )* <EOF>
ExplainStatement ::= ( <EXPLAIN> )? SingleStatement
SingleStatement ::= ( DataverseDeclaration | FunctionDeclaration | CreateStatement | LoadStatement | CopyStatement | DropStatement | SetStatement | InsertStatement | DeleteStatement | UpdateStatement | UpsertStatement | ConnectionStatement | CompactStatement | AnalyzeStatement | Query )
DataverseDeclaration ::= <USE> MultipartIdentifier
CreateStatement ::= <CREATE> ( CreateOrReplaceStatement | CreateTypeStatement | CreateNodegroupStatement | CreateDatasetStatement | CreateIndexStatement | CreateDatabaseStatement | CreateDataverseStatement | CreateFunctionStatement | CreateAdapterStatement | CreateSynonymStatement | CreateFeedStatement | CreateFeedPolicyStatement | CreateFullTextStatement | CreateViewStatement )
CreateOrReplaceStatement ::= <OR> <IDENTIFIER> ( CreateFunctionStatement | CreateViewStatement )
CreateTypeStatement ::= <TYPE> TypeSpecification
TypeSpecification ::= TypeName IfNotExists <AS> RecordTypeDef
CreateNodegroupStatement ::= <NODEGROUP> NodegroupSpecification
NodegroupSpecification ::= Identifier IfNotExists <ON> Identifier ( <COMMA> Identifier )*
Dataset ::= ( <DATASET> | <COLLECTION> )
DatasetToken ::= Dataset
CreateDatasetStatement ::= ( ( <INTERNAL> )? Dataset DatasetSpecification | <EXTERNAL> Dataset ExternalDatasetSpecification )
DatasetSpecification ::= QualifiedName ( DatasetTypeSpecification )? ( <WITH> Identifier DatasetTypeSpecification )? IfNotExists ( PrimaryKeyWithType | PrimaryKey ) ( <AUTOGENERATED> )? ( <HINTS> Properties )? ( <WITH> <FILTER> <ON> NestedField )? ( <WITH> RecordConstructor )? ( <AS> SelectExpression )?
ExternalDatasetSpecification ::= QualifiedName DatasetTypeSpecification IfNotExists <USING> AdapterName Configuration ( <HINTS> Properties )? ( <WITH> RecordConstructor )?
DatasetTypeSpecification ::= ( DatasetRecordTypeSpecification | DatasetReferenceTypeSpecification )
DatasetReferenceTypeSpecification ::= <LEFTPAREN> TypeReference <RIGHTPAREN>
DatasetRecordTypeSpecification ::= <LEFTPAREN> DatasetRecordTypeDef <RIGHTPAREN> ( RecordTypeKind <TYPE> )?
DatasetRecordTypeDef ::= DatasetRecordField ( <COMMA> DatasetRecordField )*
DatasetRecordField ::= Identifier TypeReference ( <NOT> <UNKNOWN> )?
CreateIndexStatement ::= ( <INDEX> IndexSpecification | <PRIMARY> <INDEX> PrimaryIndexSpecification )
IndexSpecification ::= ( Identifier IfNotExists <ON> QualifiedName <LEFTPAREN> IndexedElement ( <COMMA> IndexedElement )* <RIGHTPAREN> ( <TYPE> IndexType )? ( <ENFORCED> )? ( <IDENTIFIER> <UNKNOWN> <KEY> )? ( <CAST> <LEFTPAREN> CastDefaultNull <RIGHTPAREN> )? )
IndexedElement ::= ( IndexedElementUnnestSelect | ( <IDENTIFIER> <LEFTPAREN> <RIGHTPAREN> <DOT> IndexedField ) | IndexedField | <LEFTPAREN> ( IndexedElementUnnestSelect | IndexedField ) <RIGHTPAREN> )
IndexedElementUnnestSelect ::= <UNNEST> ( ( <IDENTIFIER> <LEFTPAREN> <RIGHTPAREN> <DOT> IndexedElementUnnestSelectBody ) | IndexedElementUnnestSelectBody )
IndexedElementUnnestSelectBody ::= MultipartIdentifier ( <UNNEST> MultipartIdentifier )* ( ( <COLON> IndexedTypeExpr ) | ( <SELECT> MultipartIdentifier ( <COLON> IndexedTypeExpr )? ( <COMMA> MultipartIdentifier ( <COLON> IndexedTypeExpr )? )* ) )?
IndexedField ::= MultipartIdentifier ( <COLON> IndexedTypeExpr )?
PrimaryIndexSpecification ::= ( Identifier )? IfNotExists <ON> QualifiedName ( <TYPE> <BTREE> )?
FilterField ::= Identifier
IndexType ::= ( <BTREE> | <RTREE> | <KEYWORD> | <FULLTEXT> ( <USING> Identifier )? | <NGRAM> <LEFTPAREN> <INTEGER_LITERAL> <RIGHTPAREN> )
CreateDatabaseStatement ::= <DATABASE> DatabaseSpecification
DatabaseSpecification ::= Identifier IfNotExists
CreateDataverseStatement ::= <DATAVERSE> DataverseSpecification
DataverseSpecification ::= Namespace IfNotExists
CreateAdapterStatement ::= <ADAPTER> AdapterSpecification
AdapterSpecification ::= QualifiedName IfNotExists <AS> FunctionExternalIdentifier <AT> QualifiedName
CreateViewStatement ::= <VIEW> ViewSpecification
ViewSpecification ::= QualifiedName ( ( DatasetTypeSpecification IfNotExists CastDefaultNull ( <PRIMARY> <KEY> <LEFTPAREN> PrimaryKeyFields <RIGHTPAREN> <NOT> <ENFORCED> )? ( <IDENTIFIER> <KEY> <LEFTPAREN> PrimaryKeyFields <RIGHTPAREN> <IDENTIFIER> QualifiedName <NOT> <ENFORCED> )* ) | ( IfNotExists ) ) <AS> ViewBody
ViewBody ::= ( ( VariableRef ( FieldAccessor )* ) | SelectExpression )
CastDefaultNull ::= <IDENTIFIER> <NULL> ( <IDENTIFIER> StringLiteral )*
CreateFunctionStatement ::= <FUNCTION> FunctionSpecification
FunctionSpecification ::= FunctionName FunctionParameters IfNotExists FunctionReturnType ( ( <LEFTBRACE> FunctionBody <RIGHTBRACE> ) | ( <AS> FunctionExternalIdentifier <AT> QualifiedName ( <WITH> RecordConstructor )? ) )
FunctionParameters ::= <LEFTPAREN> ( FunctionParameterList )? <RIGHTPAREN>
FunctionParameterList ::= ( ( <DOT> <DOT> <DOT> ) | ( FunctionParameter ( <COMMA> FunctionParameter )* ) )
FunctionParameter ::= VariableIdentifier ( ( <COLON> )? TypeExpr )?
FunctionReturnType ::= ( <IDENTIFIER> TypeExpr )?
FunctionBody ::= ( SelectExpression | Expression )
FunctionExternalIdentifier ::= StringLiteral ( <COMMA> StringLiteral )*
CreateFeedStatement ::= <FEED> FeedSpecification
FeedSpecification ::= QualifiedName IfNotExists <WITH> RecordConstructor
CreateFeedPolicyStatement ::= <INGESTION> <POLICY> FeedPolicySpecification
FeedPolicySpecification ::= Identifier IfNotExists <FROM> ( <POLICY> Identifier Configuration ( <DEFINITION> ConstantString )? | <PATH> ConstantString ( <DEFINITION> ConstantString )? )
CreateFullTextStatement ::= ( <FULLTEXT> ( <FILTER> CreateFullTextFilterSpec | ( <IDENTIFIER> CreateFullTextConfigSpec ) ) )
CreateFullTextFilterSpec ::= ( QualifiedName IfNotExists <AS> RecordConstructor )
CreateFullTextConfigSpec ::= ( QualifiedName IfNotExists <AS> RecordConstructor )
CreateSynonymStatement ::= <SYNONYM> SynonymSpecification
SynonymSpecification ::= QualifiedName IfNotExists <FOR> QualifiedName
IfNotExists ::= ( <IF> <NOT> <EXISTS> )?
ApplyFunction ::= <APPLY> <FUNCTION> FunctionName ( <COMMA> FunctionName )*
GetPolicy ::= <USING> <POLICY> Identifier
FunctionSignature ::= FunctionName ( FunctionParameters | ( <LEFTPAREN> FunctionArity <RIGHTPAREN> ) | ( <ATT> FunctionArity ) )
FunctionArity ::= <INTEGER_LITERAL>
PrimaryKeyWithType ::= <PRIMARY> <KEY> <LEFTPAREN> PrimaryKeyFieldsWithType <RIGHTPAREN>
PrimaryKeyFieldsWithType ::= NestedField <COLON> TypeReference ( <COMMA> NestedField <COLON> TypeReference )*
PrimaryKey ::= <PRIMARY> <KEY> PrimaryKeyFields
PrimaryKeyFields ::= NestedField ( <COMMA> NestedField )*
DropStatement ::= <DROP> ( DropDatasetStatement | DropIndexStatement | DropNodeGroupStatement | DropTypeStatement | DropDatabaseStatement | DropDataverseStatement | DropAdapterStatement | DropFunctionStatement | DropFeedStatement | DropFeedPolicyStatement | DropSynonymStatement | DropFullTextStatement | DropViewStatement )
DropDatasetStatement ::= Dataset DropDatasetSpecification
DropDatasetSpecification ::= QualifiedName IfExists
DropViewStatement ::= <VIEW> DropViewSpecification
DropViewSpecification ::= QualifiedName IfExists
DropIndexStatement ::= <INDEX> DropIndexSpecification
DropIndexSpecification ::= DoubleQualifiedName IfExists
DropFullTextStatement ::= <FULLTEXT> ( <FILTER> DropFullTextFilterSpec | ( <IDENTIFIER> DropFullTextConfigSpec ) )
DropFullTextFilterSpec ::= QualifiedName IfExists
DropFullTextConfigSpec ::= QualifiedName IfExists
DropNodeGroupStatement ::= <NODEGROUP> DropNodeGroupSpecification
DropNodeGroupSpecification ::= Identifier IfExists
DropTypeStatement ::= <TYPE> DropTypeSpecification
DropTypeSpecification ::= TypeName IfExists
DropDatabaseStatement ::= <DATABASE> DropDatabaseSpecification
DropDatabaseSpecification ::= Identifier IfExists
DropDataverseStatement ::= <DATAVERSE> DropDataverseSpecification
DropDataverseSpecification ::= Namespace IfExists
DropAdapterStatement ::= <ADAPTER> DropAdapterSpecification
DropAdapterSpecification ::= QualifiedName IfExists
DropFunctionStatement ::= <FUNCTION> DropFunctionSpecification
DropFunctionSpecification ::= FunctionSignature IfExists
DropFeedStatement ::= <FEED> DropFeedSpecification
DropFeedSpecification ::= QualifiedName IfExists
DropFeedPolicyStatement ::= <INGESTION> <POLICY> DropFeedPolicySpecification
DropFeedPolicySpecification ::= QualifiedName IfExists
DropSynonymStatement ::= <SYNONYM> DropSynonymSpecification
DropSynonymSpecification ::= QualifiedName IfExists
IfExists ::= ( <IF> <EXISTS> )?
InsertStatement ::= <INSERT> <INTO> QualifiedName ( <AS> Variable )? Query ( <RETURNING> Expression )?
UpsertStatement ::= <UPSERT> <INTO> QualifiedName ( <AS> Variable )? Query ( <RETURNING> Expression )?
DeleteStatement ::= <DELETE> <FROM> QualifiedName ( ( <AS> )? Variable )? ( <WHERE> Expression )?
UpdateStatement ::= <UPDATE> Variable <IN> Expression <WHERE> Expression <LEFTPAREN> ( UpdateClause ( <COMMA> UpdateClause )* ) <RIGHTPAREN>
UpdateClause ::= ( <SET> Expression <EQ> Expression | InsertStatement | DeleteStatement | UpdateStatement | <IF> <LEFTPAREN> Expression <RIGHTPAREN> <THEN> UpdateClause ( <ELSE> UpdateClause )? )
SetStatement ::= <SET> Identifier ConstantString
CopyStatement ::= <COPY> ( <INTO> QualifiedName ( ( <AS> )? ( DatasetTypeSpecification ) )? CopyFromStatement | <LEFTPAREN> Query <RIGHTPAREN> ( <AS> )? Variable CopyToStatement | QualifiedName ( <AS> )? ( DatasetTypeSpecification | Variable )? ( CopyFromStatement | CopyToStatement ) )
CopyFromStatement ::= <FROM> AdapterName <PATH> <LEFTPAREN> ConcatenatedStrings <RIGHTPAREN> <WITH> RecordConstructor
CopyToStatement ::= <TO> AdapterName <PATH> <LEFTPAREN> ExpressionList <RIGHTPAREN> ( CopyToOverClause )? <WITH> RecordConstructor
CopyToOverClause ::= <OVER> <LEFTPAREN> ( <IDENTIFIER> <BY> Expression ( ( <AS> )? Variable )? ( <COMMA> Expression ( ( <AS> )? Variable )? )* )? ( OrderbyClause )? <RIGHTPAREN>
LoadStatement ::= <LOAD> Dataset QualifiedName <USING> AdapterName Configuration ( <PRESORTED> )?
AdapterName ::= Identifier
AnalyzeStatement ::= <ANALYZE> DatasetToken QualifiedName ( AnalyzeDatasetDropStatement | AnalyzeDatasetStatement )
AnalyzeDatasetStatement ::= ( <WITH> RecordConstructor )?
AnalyzeDatasetDropStatement ::= <DROP> <IDENTIFIER>
CompactStatement ::= <COMPACT> Dataset QualifiedName
ConnectionStatement ::= ( <CONNECT> ConnectStatement | <DISCONNECT> DisconnectStatement | <START> StartStatement | <STOP> StopStatement )
StartStatement ::= <FEED> QualifiedName
StopStatement ::= <FEED> QualifiedName
DisconnectStatement ::= ( <FEED> QualifiedName <FROM> Dataset QualifiedName )
ConnectStatement ::= ( <FEED> QualifiedName <TO> Dataset QualifiedName ( ApplyFunction )? ( GetPolicy )? ( <WHERE> Expression )? )
Configuration ::= <LEFTPAREN> ( KeyValuePair ( <COMMA> KeyValuePair )* )? <RIGHTPAREN>
KeyValuePair ::= <LEFTPAREN> ConstantString <EQ> ( ConstantString | ( <TRUE> | <FALSE> ) ) <RIGHTPAREN>
ConcatenatedStrings ::= StringLiteral ( <COMMA> StringLiteral )*
Properties ::= ( <LEFTPAREN> Property ( <COMMA> Property )* <RIGHTPAREN> )?
Property ::= ( Identifier | StringLiteral ) <EQ> ( ConstantString | <INTEGER_LITERAL> )
IndexedTypeExpr ::= TypeExpr ( <QUES> )?
TypeExpr ::= ( TypeReference | OrderedListTypeDef | UnorderedListTypeDef | RecordTypeDef )
RecordTypeKind ::= ( <CLOSED> | <OPEN> )
RecordTypeDef ::= ( RecordTypeKind )? <LEFTBRACE> ( RecordField ( <COMMA> RecordField )* )? <RIGHTBRACE>
RecordField ::= Identifier <COLON> TypeExpr ( <QUES> )?
TypeReference ::= QualifiedName
OrderedListTypeDef ::= <LEFTBRACKET> ( TypeExpr ) <RIGHTBRACKET>
UnorderedListTypeDef ::= <LEFTDBLBRACE> ( TypeExpr ) <RIGHTDBLBRACE>
FunctionName ::= MultipartIdentifierWithHints ( <SHARP> Identifier )?
TypeName ::= QualifiedName
Identifier ::= ( <IDENTIFIER> | QuotedString )
ParenthesizedIdentifierList ::= <LEFTPAREN> Identifier ( <COMMA> Identifier )* <RIGHTPAREN>
buildOrProbeParenthesizedIdentifier ::= Identifier <LEFTPAREN> Identifier <RIGHTPAREN>
parenthesizedIdentifier ::= <LEFTPAREN> Identifier <RIGHTPAREN>
ParenthesizedLiteralList ::= <LEFTPAREN> ( <MINUS> )? Literal ( <COMMA> ( <MINUS> )? Literal )* <RIGHTPAREN>
OpenField ::= NestedField ( <COLON> IndexedTypeExpr )?
NestedField ::= Identifier ( <LEFTPAREN> <RIGHTPAREN> )? ( <DOT> Identifier )*
ConstantString ::= ( QuotedString | StringLiteral )
QuotedString ::= <QUOTED_STRING>
StringLiteral ::= ( <STRING_LITERAL> )+
MultipartIdentifier ::= MultipartIdentifierWithHints
MultipartIdentifierWithHints ::= Identifier ( <DOT> Identifier )*
Namespace ::= MultipartIdentifier
DataverseName ::= MultipartIdentifier
QualifiedName ::= MultipartIdentifier
DoubleQualifiedName ::= Identifier ( <DOT> Identifier )+
FunctionDeclaration ::= <DECLARE> <FUNCTION> Identifier FunctionParameters <LEFTBRACE> FunctionBody <RIGHTBRACE>
Query ::= ( Expression | SelectExpression )
Expression ::= ( OperatorExpr | QuantifiedExpression )
OperatorExpr ::= AndExpr ( <OR> AndExpr )*
AndExpr ::= NotExpr ( <AND> NotExpr )*
NotExpr ::= ( <NOT> )? RelExpr
RelExpr ::= BetweenExpr ( ( <LT> | <GT> | <LE> | <GE> | <EQ> | <NE> | <LG> | <SIMILAR> | ( <NOT> )? <IN> | <IS> ( <NOT> )? <DISTINCT> <FROM> ) BetweenExpr )?
BetweenExpr ::= IsExpr ( ( <NOT> )? <BETWEEN> IsExpr <AND> IsExpr )?
IsExpr ::= LikeExpr ( <IS> ( <NOT> )? ( <NULL> | <MISSING> | <UNKNOWN> | ( <KNOWN> | <VALUED> ) ) )?
LikeExpr ::= ConcatExpr ( ( <NOT> )? <LIKE> ConcatExpr )?
ConcatExpr ::= AddExpr ( <CONCAT> AddExpr )*
AddExpr ::= MultExpr ( ( <PLUS> | <MINUS> ) MultExpr )*
MultExpr ::= ExponentExpr ( ( <MUL> | <DIVIDE> | <DIV> | ( <MOD> | <PERCENT> ) ) ExponentExpr )*
ExponentExpr ::= UnaryExpr ( <CARET> UnaryExpr )?
UnaryExpr ::= ( ( <PLUS> | <MINUS> | ( <NOT> )? <EXISTS> ) )? ValueExpr
ValueExpr ::= PrimaryExpr ( FieldAccessor | IndexAccessor )*
FieldAccessor ::= <DOT> Identifier
IndexAccessor ::= <LEFTBRACKET> ( <MUL> | ( Expression ( <COLON> ( Expression )? )? ) ) <RIGHTBRACKET>
PrimaryExpr ::= ( FunctionCallExpr | CaseExpr | Literal | VariableRef | ExternalVariableRef | ListConstructor | RecordConstructor | ParenthesizedExpression )
Literal ::= ( StringLiteral | <INTEGER_LITERAL> | <FLOAT_LITERAL> | <DOUBLE_LITERAL> | <MISSING> | <NULL> | <TRUE> | <FALSE> )
VariableRef ::= VariableIdentifier
Variable ::= VariableIdentifier
VariableIdentifier ::= ( <IDENTIFIER> | QuotedString )
VariableWithFieldMap ::= Variable ( <LEFTPAREN> VariableRef <AS> Identifier ( <COMMA> VariableRef <AS> Identifier )* <RIGHTPAREN> )?
ExternalVariableRef ::= ( <DOLLAR_IDENTIFIER> | <DOLLAR_INTEGER_LITERAL> | <DOLLAR_QUOTED_STRING> | <QUES> )
ListConstructor ::= ( OrderedListConstructor | UnorderedListConstructor )
OrderedListConstructor ::= <LEFTBRACKET> ExpressionList <RIGHTBRACKET>
UnorderedListConstructor ::= <LEFTDBLBRACE> ExpressionList <RIGHTDBLBRACE>
ExpressionList ::= ( Expression ( <COMMA> Expression )* )?
RecordConstructor ::= <LEFTBRACE> ( FieldBinding ( <COMMA> FieldBinding )* )? <RIGHTBRACE>
FieldBinding ::= Expression ( <COLON> Expression )?
FunctionCallExpr ::= FunctionName <LEFTPAREN> ( ( <DISTINCT> )? ( Expression | <MUL> ) ( <COMMA> Expression )* )? <RIGHTPAREN> ( <FILTER> <LEFTPAREN> <WHERE> Expression <RIGHTPAREN> )? ( WindowExpr )?
WindowExpr ::= ( <FROM> <IDENTIFIER> )? ( <IDENTIFIER> <IDENTIFIER> )? <OVER> OverClause
OverClause ::= ( VariableWithFieldMap <AS> )? <LEFTPAREN> ( <IDENTIFIER> <BY> Expression ( <COMMA> Expression )* )? ( OrderbyClause ( WindowFrameMode ( WindowFrameBoundary | ( <BETWEEN> WindowFrameBoundary <AND> WindowFrameBoundary ) ) ( WindowFrameExclusion )? )? )? <RIGHTPAREN>
WindowFrameMode ::= <IDENTIFIER>
WindowFrameBoundary ::= ( <IDENTIFIER> | Expression ) <IDENTIFIER>
WindowFrameExclusion ::= <IDENTIFIER> ( <GROUP> | ( <IDENTIFIER> <IDENTIFIER> ) )
ParenthesizedExpression ::= ( <LEFTPAREN> Expression ( <COMMA> Expression )* <RIGHTPAREN> | Subquery )
CaseExpr ::= <CASE> ( Expression )? ( <WHEN> Expression <THEN> Expression )* ( <ELSE> Expression )? <END>
SelectExpression ::= ( LetClause )? SelectSetOperation ( OrderbyClause )? ( LimitClause )?
SelectSetOperation ::= SelectBlock ( ( <UNION> | <INTERSECT> | <EXCEPT> ) ( <ALL> )? ( SelectBlock | Subquery ) )*
Subquery ::= <LEFTPAREN> SelectExpression <RIGHTPAREN>
SelectBlock ::= ( ( SelectClause ( ( FromClause ( LetClause )? ( WhereClause )? ( GroupbyClause ( LetClause )? ( HavingClause )? )? ) | ( LetClause ( WhereClause )? ) )? ) | ( FromClause ( LetClause )? ( WhereClause )? ( GroupbyClause ( LetClause )? ( HavingClause )? )? SelectClause ) )
SelectClause ::= <SELECT> ( <ALL> | <DISTINCT> )? ( ( SelectRegular ( <IDENTIFIER> Identifier ( <DOT> Identifier )* ( <COMMA> Identifier ( <DOT> Identifier )* )* )? ) | SelectElement )?
SelectRegular ::= Projection ( <COMMA> Projection )*
SelectElement ::= ( <RAW> | <ELEMENT> | <VALUE> ) Expression
Projection ::= ( <MUL> | VariableRef <DOT> <MUL> | Expression ( ( <AS> )? Identifier )? )
FromClause ::= <FROM> FromTerm ( <COMMA> FromTerm )*
FromTerm ::= Expression ( ( <AS> )? Variable )? ( <AT> Variable )? ( ( JoinOrUnnestClause | ( <INNER> JoinOrUnnestClause ) | ( <LEFT> ( <OUTER> )? JoinOrUnnestClause ) | ( <RIGHT> ( <OUTER> )? JoinClause ) | ( <CROSS> CrossJoinClause ) ) )*
JoinOrUnnestClause ::= ( JoinClause | UnnestClause )
JoinClause ::= <JOIN> JoinClauseRightInput <ON> Expression
CrossJoinClause ::= <JOIN> JoinClauseRightInput
JoinClauseRightInput ::= Expression ( ( <AS> )? Variable )? ( <AT> Variable )?
UnnestClause ::= ( <UNNEST> | <CORRELATE> | <FLATTEN> ) Expression ( ( <AS> )? Variable )? ( <AT> Variable )?
LetClause ::= ( ( <LET> | <LETTING> ) LetElement ( <COMMA> LetElement )* | <WITH> WithElement ( <COMMA> WithElement )* )
WhereClause ::= <WHERE> Expression
OrderbyClause ::= <ORDER> <BY> OrderByExpression ( <COMMA> OrderByExpression )*
OrderByExpression ::= Expression ( <ASC> | <DESC> )? ( <IDENTIFIER> <IDENTIFIER> )?
GroupbyClause ::= <GROUP> <BY> GroupingElementList ( <GROUP> <AS> VariableWithFieldMap )?
GroupingElementList ::= GroupingElement ( <COMMA> GroupingElement )*
GroupingElement ::= ( <LEFTPAREN> <RIGHTPAREN> | <IDENTIFIER> <LEFTPAREN> OrdinaryGroupingSetList <RIGHTPAREN> | <IDENTIFIER> <LEFTPAREN> OrdinaryGroupingSetList <RIGHTPAREN> | <IDENTIFIER> <IDENTIFIER> <LEFTPAREN> GroupingElementList <RIGHTPAREN> | OrdinaryGroupingSet )
OrdinaryGroupingSet ::= ( <LEFTPAREN> GbyVariableExpressionPairList <RIGHTPAREN> | GbyVariableExpressionPair )
OrdinaryGroupingSetList ::= OrdinaryGroupingSet ( <COMMA> OrdinaryGroupingSet )*
GbyVariableExpressionPairList ::= GbyVariableExpressionPair ( <COMMA> GbyVariableExpressionPair )*
GbyVariableExpressionPair ::= Expression ( ( <AS> )? Variable )?
HavingClause ::= <HAVING> Expression
LimitClause ::= ( ( <LIMIT> Expression ( <OFFSET> Expression )? ) | ( <OFFSET> Expression ) )
QuantifiedExpression ::= ( ( <ANY> | <SOME> ) <AND> <EVERY> | ( <ANY> | <SOME> ) | <EVERY> ) Variable <IN> Expression ( <COMMA> Variable <IN> Expression )* <SATISFIES> Expression ( <END> )?
LetElement ::= Variable <EQ> Expression
WithElement ::= Variable <AS> Expression