@@ -156,8 +156,9 @@ createTable
156
156
simpleCreateTable
157
157
: KW_CREATE KW_TEMPORARY ? KW_TABLE ifNotExists? tablePathCreate LR_BRACKET columnOptionDefinition (
158
158
COMMA columnOptionDefinition
159
- )* (COMMA watermarkDefinition)? (COMMA tableConstraint)? (COMMA selfDefinitionClause)? RR_BRACKET commentSpec? partitionDefinition? withOption
160
- likeDefinition?
159
+ )* (COMMA watermarkDefinition)? (COMMA tableConstraint)? (COMMA selfDefinitionClause)? RR_BRACKET (
160
+ KW_COMMENT comment=STRING_LITERAL
161
+ )? partitionDefinition? withOption likeDefinition?
161
162
;
162
163
163
164
/*
@@ -175,7 +176,7 @@ columnOptionDefinition
175
176
;
176
177
177
178
physicalColumnDefinition
178
- : columnNameCreate columnType columnConstraint? commentSpec ?
179
+ : columnNameCreate columnType columnConstraint? ( KW_COMMENT comment= STRING_LITERAL ) ?
179
180
;
180
181
181
182
columnNameCreate
@@ -193,8 +194,8 @@ columnNameList
193
194
;
194
195
195
196
columnType
196
- : typeName =(KW_DATE | KW_BOOLEAN | KW_NULL )
197
- | typeName =(
197
+ : colType =(KW_DATE | KW_BOOLEAN | KW_NULL )
198
+ | colType =(
198
199
KW_CHAR
199
200
| KW_VARCHAR
200
201
| KW_STRING
@@ -210,12 +211,12 @@ columnType
210
211
| KW_TIMESTAMP_LTZ
211
212
| KW_DATETIME
212
213
) lengthOneDimension?
213
- | typeName =KW_TIMESTAMP lengthOneDimension? ((KW_WITHOUT | KW_WITH ) KW_LOCAL ? KW_TIME KW_ZONE )?
214
- | typeName =(KW_DECIMAL | KW_DEC | KW_NUMERIC | KW_FLOAT | KW_DOUBLE ) lengthTwoOptionalDimension?
215
- | type =(KW_ARRAY | KW_MULTISET ) lengthOneTypeDimension?
216
- | type =KW_MAP mapTypeDimension?
217
- | type =KW_ROW rowTypeDimension?
218
- | type =KW_RAW lengthTwoStringDimension?
214
+ | colType =KW_TIMESTAMP lengthOneDimension? ((KW_WITHOUT | KW_WITH ) KW_LOCAL ? KW_TIME KW_ZONE )?
215
+ | colType =(KW_DECIMAL | KW_DEC | KW_NUMERIC | KW_FLOAT | KW_DOUBLE ) lengthTwoOptionalDimension?
216
+ | colType =(KW_ARRAY | KW_MULTISET ) lengthOneTypeDimension?
217
+ | colType =KW_MAP mapTypeDimension?
218
+ | colType =KW_ROW rowTypeDimension?
219
+ | colType =KW_RAW lengthTwoStringDimension?
219
220
;
220
221
221
222
lengthOneDimension
@@ -247,10 +248,6 @@ columnConstraint
247
248
| KW_NOT ? KW_NULL
248
249
;
249
250
250
- commentSpec
251
- : KW_COMMENT STRING_LITERAL
252
- ;
253
-
254
251
metadataColumnDefinition
255
252
: columnNameCreate columnType KW_METADATA (KW_FROM metadataKey)? KW_VIRTUAL ?
256
253
;
@@ -260,7 +257,7 @@ metadataKey
260
257
;
261
258
262
259
computedColumnDefinition
263
- : columnNameCreate KW_AS computedColumnExpression commentSpec ?
260
+ : columnNameCreate KW_AS computedColumnExpression ( KW_COMMENT comment= STRING_LITERAL ) ?
264
261
;
265
262
266
263
// 计算表达式
@@ -316,11 +313,13 @@ createCatalog
316
313
;
317
314
318
315
createDatabase
319
- : KW_CREATE KW_DATABASE ifNotExists? databasePathCreate commentSpec ? withOption
316
+ : KW_CREATE KW_DATABASE ifNotExists? databasePathCreate ( KW_COMMENT comment= STRING_LITERAL ) ? withOption
320
317
;
321
318
322
319
createView
323
- : KW_CREATE KW_TEMPORARY ? KW_VIEW ifNotExists? viewPathCreate columnNameList? commentSpec? KW_AS queryStatement
320
+ : KW_CREATE KW_TEMPORARY ? KW_VIEW ifNotExists? viewPathCreate columnNameList? (
321
+ KW_COMMENT comment=STRING_LITERAL
322
+ )? KW_AS queryStatement
324
323
;
325
324
326
325
createFunction
@@ -513,8 +512,8 @@ tableReference
513
512
;
514
513
515
514
tablePrimary
516
- : KW_TABLE ? tablePath systemTimePeriod? ( KW_AS ? correlationName)?
517
- | viewPath systemTimePeriod? ( KW_AS ? correlationName)?
515
+ : KW_TABLE ? tablePath systemTimePeriod?
516
+ | viewPath systemTimePeriod?
518
517
| KW_LATERAL KW_TABLE LR_BRACKET functionName LR_BRACKET functionParam (COMMA functionParam)* RR_BRACKET RR_BRACKET
519
518
| KW_LATERAL ? LR_BRACKET queryStatement RR_BRACKET
520
519
| KW_UNNEST LR_BRACKET expression RR_BRACKET
@@ -834,7 +833,7 @@ intervalValue
834
833
;
835
834
836
835
tableAlias
837
- : KW_AS ? identifier identifierList?
836
+ : KW_AS ? alias= identifier identifierList?
838
837
;
839
838
840
839
errorCapturingIdentifier
0 commit comments