@@ -54,7 +54,7 @@ statement
54
54
55
55
statementDefault : query;
56
56
57
- use : KW_USE schema=identifier ;
57
+ use : KW_USE databaseNamePath ;
58
58
59
59
createStatement
60
60
: createSchema
@@ -77,7 +77,7 @@ createTableSelect
77
77
78
78
createTableLike
79
79
: KW_CREATE KW_EXTERNAL ? KW_TABLE ifNotExists? tableNameCreate
80
- KW_LIKE (likeTableName=qualifiedName | KW_PARQUET parquet=stringLiteral)
80
+ KW_LIKE (tableNamePath | KW_PARQUET parquet=stringLiteral)
81
81
(KW_PARTITIONED KW_BY partitionedBy)?
82
82
createCommonItem
83
83
;
@@ -172,7 +172,7 @@ dropPartitionByRangeOrValue: KW_ALTER KW_TABLE tableNamePath KW_DROP ifExists? (
172
172
173
173
alterView : KW_ALTER KW_VIEW viewNamePath viewColumns? KW_AS query;
174
174
175
- renameView : KW_ALTER KW_VIEW viewNamePath KW_RENAME KW_TO qualifiedName ;
175
+ renameView : KW_ALTER KW_VIEW viewNamePath KW_RENAME KW_TO viewNamePath ;
176
176
177
177
alterViewOwner : KW_ALTER KW_VIEW viewNamePath KW_SET KW_OWNER (KW_USER |KW_ROLE ) qualifiedName;
178
178
@@ -244,11 +244,11 @@ deleteStatement
244
244
| deleteTableRef
245
245
;
246
246
247
- delete : KW_DELETE KW_FROM ? qualifiedName (KW_WHERE booleanExpression)?;
247
+ delete : KW_DELETE KW_FROM ? tableNamePath (KW_WHERE booleanExpression)?;
248
248
249
- deleteTableRef : KW_DELETE qualifiedName (KW_AS ? identifier)? KW_FROM (relation (COMMA relation)*)? (KW_WHERE booleanExpression)?;
249
+ deleteTableRef : KW_DELETE tableNamePath (KW_AS ? identifier)? KW_FROM (relation (COMMA relation)*)? (KW_WHERE booleanExpression)?;
250
250
251
- updateStatement : KW_UPDATE qualifiedName KW_SET assignmentList (KW_FROM relation (COMMA relation)*)? (KW_WHERE booleanExpression)?;
251
+ updateStatement : KW_UPDATE tableNamePath KW_SET assignmentList (KW_FROM relation (COMMA relation)*)? (KW_WHERE booleanExpression)?;
252
252
253
253
upsertStatement : KW_UPSERT KW_INTO KW_TABLE ? tableNamePath columnAliases? query;
254
254
@@ -376,7 +376,7 @@ viewNameCreate
376
376
| identifier (DOT identifier)?
377
377
;
378
378
379
- functionNameCreate : qualifiedName ;
379
+ functionNameCreate : identifier ;
380
380
381
381
databaseNamePath : identifier;
382
382
@@ -390,7 +390,7 @@ viewNamePath
390
390
| identifier (DOT identifier)?
391
391
;
392
392
393
- functionNamePath : qualifiedName ;
393
+ functionNamePath : identifier ;
394
394
395
395
columnNamePath
396
396
: identifier
@@ -437,7 +437,7 @@ constraintSpecification
437
437
438
438
foreignKeySpecification
439
439
:
440
- KW_FOREIGN KW_KEY columnAliases KW_REFERENCES tblName=qualifiedName columnAliases (KW_DISABLE )? (KW_NOVALIDATE )? (KW_RELY )?
440
+ KW_FOREIGN KW_KEY columnAliases KW_REFERENCES tableNamePath columnAliases (KW_DISABLE )? (KW_NOVALIDATE )? (KW_RELY )?
441
441
;
442
442
443
443
columnDefinition
@@ -592,7 +592,7 @@ groupingSet
592
592
;
593
593
594
594
namedQuery
595
- : name=identifier (columnAliases)? KW_AS LPAREN query RPAREN
595
+ : name=identifier (columnAliases)? KW_AS subQueryRelation
596
596
;
597
597
598
598
setQuantifier
@@ -652,13 +652,16 @@ columnAliases
652
652
;
653
653
654
654
relationPrimary
655
- : qualifiedName #tableName
656
- | LPAREN query RPAREN #subqueryRelation
657
- | KW_UNNEST LPAREN expression (COMMA expression)* RPAREN (KW_WITH KW_ORDINALITY )? #unnest
658
- | KW_LATERAL LPAREN query RPAREN #lateral
659
- | LPAREN relation RPAREN #parenthesizedRelation
655
+ : tableNamePath
656
+ | KW_LATERAL ? subQueryRelation
657
+ | unnest
658
+ | parenthesizedRelation
660
659
;
661
660
661
+ subQueryRelation : LPAREN query RPAREN ;
662
+ unnest : KW_UNNEST LPAREN expression (COMMA expression)* RPAREN (KW_WITH KW_ORDINALITY )?;
663
+ parenthesizedRelation : LPAREN relation RPAREN ;
664
+
662
665
expression
663
666
: booleanExpression
664
667
;
@@ -672,10 +675,10 @@ booleanExpression
672
675
673
676
predicate [ParserRuleContext value]
674
677
: comparisonOperator right=valueExpression #comparison
675
- | comparisonOperator comparisonQuantifier LPAREN query RPAREN #quantifiedComparison
678
+ | comparisonOperator comparisonQuantifier subQueryRelation #quantifiedComparison
676
679
| KW_NOT ? KW_BETWEEN lower=valueExpression KW_AND upper=valueExpression #between
677
680
| KW_NOT ? KW_IN LPAREN expression (COMMA expression)* RPAREN #inList
678
- | KW_NOT ? KW_IN LPAREN query RPAREN #inSubquery
681
+ | KW_NOT ? KW_IN subQueryRelation #inSubquery
679
682
| KW_NOT ? KW_LIKE pattern=valueExpression (KW_ESCAPE escape=valueExpression)? #like
680
683
| KW_REGEXP pattern=valueExpression #REGEXP
681
684
| KW_IS KW_NOT ? KW_NULL #nullPredicate
@@ -703,8 +706,8 @@ primaryExpression
703
706
| KW_POSITION LPAREN valueExpression KW_IN valueExpression RPAREN #position
704
707
| LPAREN expression (KW_AS type)? (COMMA expression (KW_AS type)?)*? RPAREN #rowConstructor
705
708
| KW_ROW LPAREN expression (COMMA expression)* RPAREN #rowConstructor
706
- | qualifiedName LPAREN ASTERISK RPAREN filter? over? #functionCall
707
- | qualifiedName LPAREN (setQuantifier? expression (COMMA expression)*)?
709
+ | functionNamePath LPAREN ASTERISK RPAREN filter? over? #functionCall
710
+ | functionNamePath LPAREN (setQuantifier? expression (COMMA expression)*)?
708
711
(KW_ORDER KW_BY sortItem (COMMA sortItem)*)? RPAREN filter? over? #functionCall
709
712
| identifier RIGHT_ARROW expression #lambda
710
713
| LPAREN (identifier (COMMA identifier)*)? RPAREN RIGHT_ARROW expression #lambda
0 commit comments