feat: update the builtin funcs of flinksql (#102)

* style: put evrry branch on a single line

* feat: support ASYMMETRIC and SYMMETRIC for between and

* feat: support SIMILAR TO predicate

* feat: support nested boolean expression

* feat: support escape to like and similar in flink sql

* test: add where clause test cases

* feat: add reservedKeywordsUsedAsFunctionName rule

* feat: add timepointLiteral rule and improve function call grammar
This commit is contained in:
Hayden 2023-05-24 15:03:08 +08:00 committed by GitHub
parent c409b80ee1
commit 0924acf730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 5984 additions and 5237 deletions

View File

@ -46,6 +46,7 @@ KW_DIV: 'DIV';
KW_ENCODING: 'ENCODING'; KW_ENCODING: 'ENCODING';
KW_ENFORCED: 'ENFORCED'; KW_ENFORCED: 'ENFORCED';
KW_ENGINE: 'ENGINE'; KW_ENGINE: 'ENGINE';
KW_EPOCH: 'EPOCH';
KW_ERROR: 'ERROR'; KW_ERROR: 'ERROR';
KW_ESTIMATED_COST: 'ESTIMATED_COST'; KW_ESTIMATED_COST: 'ESTIMATED_COST';
KW_EXCEPTION: 'EXCEPTION'; KW_EXCEPTION: 'EXCEPTION';
@ -181,6 +182,7 @@ KW_VIRTUAL: 'VIRTUAL';
KW_WATERMARK: 'WATERMARK'; KW_WATERMARK: 'WATERMARK';
KW_WATERMARKS: 'WATERMARKS'; KW_WATERMARKS: 'WATERMARKS';
KW_WEEK: 'WEEK'; KW_WEEK: 'WEEK';
KW_WEEKS: 'WEEKS';
KW_WORK: 'WORK'; KW_WORK: 'WORK';
KW_WRAPPER: 'WRAPPER'; KW_WRAPPER: 'WRAPPER';
KW_YEARS: 'YEARS'; KW_YEARS: 'YEARS';
@ -194,13 +196,14 @@ KW_ZONE: 'ZONE';
KW_ABS: 'ABS'; KW_ABS: 'ABS';
KW_ALL: 'ALL'; KW_ALL: 'ALL';
ALLOW: 'ALLOW'; KW_ALLOW: 'ALLOW';
KW_ALTER : 'ALTER'; KW_ALTER : 'ALTER';
KW_AND: 'AND'; KW_AND: 'AND';
KW_ANY: 'ANY'; KW_ANY: 'ANY';
KW_ARE: 'ARE'; KW_ARE: 'ARE';
KW_ARRAY: 'ARRAY'; KW_ARRAY: 'ARRAY';
KW_AS: 'AS'; KW_AS: 'AS';
KW_ASYMMETRIC: 'ASYMMETRIC';
KW_AT: 'AT'; KW_AT: 'AT';
KW_AVG: 'AVG'; KW_AVG: 'AVG';
KW_BEGIN: 'BEGIN'; KW_BEGIN: 'BEGIN';
@ -256,6 +259,7 @@ KW_EACH: 'EACH';
KW_ELSE: 'ELSE'; KW_ELSE: 'ELSE';
KW_END: 'END'; KW_END: 'END';
KW_EQUALS: 'EQUALS'; KW_EQUALS: 'EQUALS';
KW_ESCAPE: 'ESCAPE';
KW_EXCEPT: 'EXCEPT'; KW_EXCEPT: 'EXCEPT';
KW_EXECUTE: 'EXECUTE'; KW_EXECUTE: 'EXECUTE';
KW_EXISTS: 'EXISTS'; KW_EXISTS: 'EXISTS';
@ -330,6 +334,7 @@ KW_PER: 'PER';
KW_PERCENT: 'PERCENT'; KW_PERCENT: 'PERCENT';
KW_PERIOD: 'PERIOD'; KW_PERIOD: 'PERIOD';
KW_POSITION: 'POSITION'; KW_POSITION: 'POSITION';
KW_POWER: 'POWER';
KW_PRIMARY: 'PRIMARY'; KW_PRIMARY: 'PRIMARY';
KW_RANGE: 'RANGE'; KW_RANGE: 'RANGE';
KW_RANK: 'RANK'; KW_RANK: 'RANK';
@ -345,12 +350,14 @@ KW_SECOND: 'SECOND';
KW_SELECT: 'SELECT'; KW_SELECT: 'SELECT';
KW_SET: 'SET'; KW_SET: 'SET';
KW_SHOW: 'SHOW'; KW_SHOW: 'SHOW';
KW_SIMILAR: 'SIMILAR';
KW_SKIP: 'SKIP'; KW_SKIP: 'SKIP';
KW_SMALLINT: 'SMALLINT'; KW_SMALLINT: 'SMALLINT';
KW_START: 'START'; KW_START: 'START';
KW_STATIC: 'STATIC'; KW_STATIC: 'STATIC';
KW_SUBSTRING: 'SUBSTRING'; KW_SUBSTRING: 'SUBSTRING';
KW_SUM: 'SUM'; KW_SUM: 'SUM';
KW_SYMMETRIC: 'SYMMETRIC';
KW_SYSTEM: 'SYSTEM'; KW_SYSTEM: 'SYSTEM';
KW_SYSTEM_TIME: 'SYSTEM_TIME'; KW_SYSTEM_TIME: 'SYSTEM_TIME';
KW_SYSTEM_USER: 'SYSTEM_USER'; KW_SYSTEM_USER: 'SYSTEM_USER';
@ -361,6 +368,7 @@ KW_TIME: 'TIME';
KW_TIMESTAMP: 'TIMESTAMP'; KW_TIMESTAMP: 'TIMESTAMP';
KW_TINYINT: 'TINYINT'; KW_TINYINT: 'TINYINT';
KW_TO: 'TO'; KW_TO: 'TO';
KW_TRAILING: 'TRAILING';
KW_TRUE: 'TRUE'; KW_TRUE: 'TRUE';
KW_TRUNCATE: 'TRUNCATE'; KW_TRUNCATE: 'TRUNCATE';
KW_UNION: 'UNION'; KW_UNION: 'UNION';
@ -425,7 +433,7 @@ DOUBLE_VERTICAL_SIGN: '||';
DOUBLE_HYPNEN_SIGN: '--'; DOUBLE_HYPNEN_SIGN: '--';
SLASH_SIGN: '/'; SLASH_SIGN: '/';
QUESTION_MARK_SIGN: '?'; QUESTION_MARK_SIGN: '?';
DOUBLE_RIGHT_ARROW: '=>'; DOUBLE_RIGHT_ARROW: '=>';
STRING_LITERAL: DQUOTA_STRING | SQUOTA_STRING | BQUOTA_STRING; STRING_LITERAL: DQUOTA_STRING | SQUOTA_STRING | BQUOTA_STRING;
DIG_LITERAL: DEC_DIGIT+; DIG_LITERAL: DEC_DIGIT+;
REAL_LITERAL: (DEC_DIGIT+)? '.' DEC_DIGIT+ REAL_LITERAL: (DEC_DIGIT+)? '.' DEC_DIGIT+

View File

@ -445,7 +445,7 @@ tableReference
tablePrimary tablePrimary
: KW_TABLE? tablePath systemTimePeriod? (KW_AS? correlationName)? : KW_TABLE? tablePath systemTimePeriod? (KW_AS? correlationName)?
| KW_LATERAL KW_TABLE LR_BRACKET functionName LR_BRACKET expression (COMMA expression)* RR_BRACKET RR_BRACKET | KW_LATERAL KW_TABLE LR_BRACKET functionName LR_BRACKET functionParam (COMMA functionParam)* RR_BRACKET RR_BRACKET
| KW_LATERAL? LR_BRACKET queryStatement RR_BRACKET | KW_LATERAL? LR_BRACKET queryStatement RR_BRACKET
| KW_UNNEST LR_BRACKET expression RR_BRACKET | KW_UNNEST LR_BRACKET expression RR_BRACKET
; ;
@ -664,24 +664,27 @@ booleanExpression
| valueExpression predicate? #predicated | valueExpression predicate? #predicated
| left=booleanExpression operator=KW_AND right=booleanExpression #logicalBinary | left=booleanExpression operator=KW_AND right=booleanExpression #logicalBinary
| left=booleanExpression operator=KW_OR right=booleanExpression #logicalBinary | left=booleanExpression operator=KW_OR right=booleanExpression #logicalBinary
| booleanExpression KW_IS KW_NOT? kind=(KW_TRUE | KW_FALSE | KW_UNKNOWN | KW_NULL) #logicalNested
; ;
predicate predicate
: KW_NOT? kind=KW_BETWEEN lower=valueExpression KW_AND upper=valueExpression : KW_NOT?
kind=KW_BETWEEN (KW_ASYMMETRIC | KW_SYMMETRIC)?
lower=valueExpression KW_AND
upper=valueExpression
| KW_NOT? kind=KW_IN '(' expression (',' expression)* ')' | KW_NOT? kind=KW_IN '(' expression (',' expression)* ')'
| KW_NOT? kind=KW_IN '(' queryStatement ')' | KW_NOT? kind=KW_IN '(' queryStatement ')'
| kind=KW_EXISTS '(' queryStatement ')' | kind=KW_EXISTS '(' queryStatement ')'
| KW_NOT? kind=KW_RLIKE pattern=valueExpression | KW_NOT? kind=KW_RLIKE pattern=valueExpression
| KW_NOT? kind=KW_LIKE quantifier=(KW_ANY | KW_ALL) ('('')' | '(' expression (',' expression)* ')') | likePredicate
| KW_NOT? kind=KW_LIKE pattern=valueExpression | KW_IS KW_NOT? kind=(KW_TRUE | KW_FALSE | KW_UNKNOWN | KW_NULL)
| KW_IS KW_NOT? kind=KW_NULL
| KW_IS KW_NOT? kind=(KW_TRUE | KW_FALSE)
| KW_IS KW_NOT? kind=KW_DISTINCT KW_FROM right=valueExpression | KW_IS KW_NOT? kind=KW_DISTINCT KW_FROM right=valueExpression
| KW_NOT? kind=KW_SIMILAR KW_TO right=valueExpression (KW_ESCAPE stringLiteral)?
; ;
likePredicate likePredicate
: KW_NOT? kind=KW_LIKE quantifier=(KW_ANY | KW_ALL) ('('')' | '(' expression (',' expression)* ')') : KW_NOT? kind=KW_LIKE quantifier=(KW_ANY | KW_ALL) ('('')' | '(' expression (',' expression)* ')')
| KW_NOT? kind=KW_LIKE pattern=valueExpression | KW_NOT? kind=KW_LIKE pattern=valueExpression (KW_ESCAPE stringLiteral)?
; ;
valueExpression valueExpression
@ -708,7 +711,7 @@ primaryExpression
| uid '.' '*' #star | uid '.' '*' #star
// | '(' namedExpression (',' namedExpression)+ ')' #rowConstructor // | '(' namedExpression (',' namedExpression)+ ')' #rowConstructor
| '(' queryStatement ')' #subqueryExpression | '(' queryStatement ')' #subqueryExpression
| functionName '(' (setQuantifier? expression (',' expression)*)? ')' #functionCall | functionName '(' (setQuantifier? functionParam (',' functionParam)*)? ')' #functionCall
// | identifier '->' expression #lambda // | identifier '->' expression #lambda
// | '(' identifier (',' identifier)+ ')' '->' expression #lambda // | '(' identifier (',' identifier)+ ')' '->' expression #lambda
| value=primaryExpression LS_BRACKET index=valueExpression RS_BRACKET #subscript | value=primaryExpression LS_BRACKET index=valueExpression RS_BRACKET #subscript
@ -725,16 +728,22 @@ primaryExpression
; ;
functionName functionName
: reservedKeywords : reservedKeywordsUsedAsFuncName
| nonReservedKeywords | nonReservedKeywords
| uid | uid
; ;
functionParam
: reservedKeywordsUsedAsFuncParam
| timeIntervalUnit
| timePointUnit
| expression
;
dereferenceDefinition dereferenceDefinition
: uid : uid
; ;
// base common // base common
correlationName correlationName
@ -754,7 +763,7 @@ errorCapturingMultiUnitsInterval
; ;
multiUnitsInterval multiUnitsInterval
: (intervalValue intervalTimeUnit)+ : (intervalValue timeIntervalUnit)+
; ;
errorCapturingUnitToUnitInterval errorCapturingUnitToUnitInterval
@ -762,7 +771,7 @@ errorCapturingUnitToUnitInterval
; ;
unitToUnitInterval unitToUnitInterval
: value=intervalValue from=intervalTimeUnit KW_TO to=intervalTimeUnit : value=intervalValue from=timeIntervalUnit KW_TO to=timeIntervalUnit
; ;
intervalValue intervalValue
@ -770,11 +779,6 @@ intervalValue
| STRING_LITERAL | STRING_LITERAL
; ;
intervalTimeUnit // TODO: 需要整理 interval 时间粒度比如 SECOND、DAY
: identifier
| reservedKeywords
;
columnAlias columnAlias
: KW_AS? identifier identifierList? : KW_AS? identifier identifierList?
; ;
@ -853,34 +857,62 @@ tablePropertyValue
; ;
logicalOperator logicalOperator
: KW_AND | '&' '&' | KW_OR | '|' '|' : KW_AND
| '&' '&'
| KW_OR
| '|' '|'
; ;
comparisonOperator comparisonOperator
: '=' | '>' | '<' | '<' '=' | '>' '=' : '='
| '<' '>' | '!' '=' | '<' '=' '>' | '>'
| '<'
| '<' '='
| '>' '='
| '<' '>'
| '!' '='
| '<' '=' '>'
; ;
bitOperator bitOperator
: '<' '<' | '>' '>' | '&' | '^' | '|' : '<' '<'
| '>' '>'
| '&'
| '^'
| '|'
; ;
mathOperator mathOperator
: '*' | SLASH_SIGN | PENCENT_SIGN | KW_DIV | '+' | '-' | DOUBLE_HYPNEN_SIGN : '*'
| SLASH_SIGN
| PENCENT_SIGN
| KW_DIV
| '+'
| '-'
| DOUBLE_HYPNEN_SIGN
; ;
unaryOperator unaryOperator
: '!' | '~' | ADD_SIGN | '-' | KW_NOT : '!'
| '~'
| ADD_SIGN
| '-'
| KW_NOT
; ;
constant constant
: stringLiteral // 引号包含的字符串 : timeIntervalExpression
| decimalLiteral // 整数 | timePointLiteral
| timeIntervalExpression // KW_INTERVAL keywords | stringLiteral // 引号包含的字符串
| HYPNEN_SIGN decimalLiteral // 负整数 | HYPNEN_SIGN? decimalLiteral // 正/负整数
| booleanLiteral // 布尔值 | booleanLiteral // 布尔值
| REAL_LITERAL // 小数 | REAL_LITERAL // 小数
| BIT_STRING | BIT_STRING
| KW_NOT? KW_NULL // 空 | 非空 | KW_NOT? KW_NULL // 空 | 非空
;
timePointLiteral
: timePointUnit stringLiteral
; ;
stringLiteral stringLiteral
@ -899,16 +931,99 @@ setQuantifier
| KW_ALL | KW_ALL
; ;
timePointUnit
: KW_YEAR
| KW_QUARTER
| KW_MONTH
| KW_WEEK
| KW_DAY
| KW_HOUR
| KW_MINUTE
| KW_SECOND
| KW_MILLISECOND
| KW_MICROSECOND
;
timeIntervalUnit
: KW_MILLENNIUM
| KW_CENTURY
| KW_DECADE
| KW_YEAR
| KW_YEARS
| KW_QUARTER
| KW_MONTH
| KW_MONTHS
| KW_WEEK
| KW_WEEKS
| KW_DAY
| KW_DAYS
| KW_HOUR
| KW_HOURS
| KW_MINUTE
| KW_MINUTES
| KW_SECOND
| KW_SECONDS
| KW_MILLISECOND
| KW_MICROSECOND
| KW_NANOSECOND
| KW_EPOCH
;
reservedKeywordsUsedAsFuncParam
: KW_LEADING
| KW_TRAILING
| KW_BOTH
| KW_ALL
| KW_DISTINCT
| ASTERISK_SIGN
;
reservedKeywordsUsedAsFuncName
: KW_ABS
| KW_ARRAY
| KW_AVG
| KW_CAST
| KW_CEIL
| KW_COALESCE
| KW_COLLECT
| KW_COUNT
| KW_DATE
| KW_GROUPING
| KW_HOUR
| KW_IF
| KW_LAG
| KW_LEFT
| KW_MAP
| KW_MINUTE
| KW_MONTH
| KW_OVERLAY
| KW_POSITION
| KW_POWER
| KW_QUARTER
| KW_RANK
| KW_RIGHT
| KW_SECOND
| KW_SUBSTRING
| KW_SUM
| KW_TIME
| KW_TIMESTAMP
| KW_TRUNCATE
| KW_UPPER
| KW_WEEK
| KW_YEAR
;
reservedKeywords reservedKeywords
: KW_ABS : KW_ABS
| KW_ALL | KW_ALL
| ALLOW | KW_ALLOW
| KW_ALTER | KW_ALTER
| KW_AND | KW_AND
| KW_ANY | KW_ANY
| KW_ARE | KW_ARE
| KW_ARRAY | KW_ARRAY
| KW_AS | KW_AS
| KW_ASYMMETRIC
| KW_AT | KW_AT
| KW_AVG | KW_AVG
| KW_BEGIN | KW_BEGIN
@ -1053,12 +1168,14 @@ reservedKeywords
| KW_SELECT | KW_SELECT
| KW_SET | KW_SET
| KW_SHOW | KW_SHOW
| KW_SIMILAR
| KW_SKIP | KW_SKIP
| KW_SMALLINT | KW_SMALLINT
| KW_START | KW_START
| KW_STATIC | KW_STATIC
| KW_SUBSTRING | KW_SUBSTRING
| KW_SUM | KW_SUM
| KW_SYSTEM_TIME
| KW_SYSTEM | KW_SYSTEM
| KW_SYSTEM_TIME | KW_SYSTEM_TIME
| KW_SYSTEM_USER | KW_SYSTEM_USER

File diff suppressed because one or more lines are too long

View File

@ -174,232 +174,237 @@ KW_YEARS=173
KW_ZONE=174 KW_ZONE=174
KW_ABS=175 KW_ABS=175
KW_ALL=176 KW_ALL=176
ALLOW=177 KW_ALLOW=177
KW_ALTER=178 KW_ALTER=178
KW_AND=179 KW_AND=179
KW_ANY=180 KW_ANY=180
KW_ARE=181 KW_ARE=181
KW_ARRAY=182 KW_ARRAY=182
KW_AS=183 KW_AS=183
KW_AT=184 KW_ASYMMETRIC=184
KW_AVG=185 KW_AT=185
KW_BEGIN=186 KW_AVG=186
KW_BETWEEN=187 KW_BEGIN=187
KW_BIGINT=188 KW_BETWEEN=188
KW_BINARY=189 KW_BIGINT=189
KW_BIT=190 KW_BINARY=190
KW_BLOB=191 KW_BIT=191
KW_BOOLEAN=192 KW_BLOB=192
KW_BOTH=193 KW_BOOLEAN=193
KW_BY=194 KW_BOTH=194
KW_CALL=195 KW_BY=195
KW_CALLED=196 KW_CALL=196
KW_CASCADED=197 KW_CALLED=197
KW_CASE=198 KW_CASCADED=198
KW_CAST=199 KW_CASE=199
KW_CEIL=200 KW_CAST=200
KW_CHAR=201 KW_CEIL=201
KW_CHARACTER=202 KW_CHAR=202
KW_CHECK=203 KW_CHARACTER=203
KW_CLOB=204 KW_CHECK=204
KW_CLOSE=205 KW_CLOB=205
KW_COALESCE=206 KW_CLOSE=206
KW_COLLATE=207 KW_COALESCE=207
KW_COLLECT=208 KW_COLLATE=208
KW_COLUMN=209 KW_COLLECT=209
KW_COMMIT=210 KW_COLUMN=210
KW_CONNECT=211 KW_COMMIT=211
KW_CONSTRAINT=212 KW_CONNECT=212
KW_CONTAINS=213 KW_CONSTRAINT=213
KW_CONVERT=214 KW_CONTAINS=214
KW_COUNT=215 KW_CONVERT=215
KW_CREATE=216 KW_COUNT=216
KW_CROSS=217 KW_CREATE=217
KW_CUBE=218 KW_CROSS=218
KW_CURRENT=219 KW_CUBE=219
KW_CURSOR=220 KW_CURRENT=220
KW_CYCLE=221 KW_CURSOR=221
KW_DATE=222 KW_CYCLE=222
KW_DATETIME=223 KW_DATE=223
KW_DAY=224 KW_DATETIME=224
KW_DEC=225 KW_DAY=225
KW_DECIMAL=226 KW_DEC=226
KW_DECLARE=227 KW_DECIMAL=227
KW_DEFAULT=228 KW_DECLARE=228
KW_DEFINE=229 KW_DEFAULT=229
KW_DELETE=230 KW_DEFINE=230
KW_DESCRIBE=231 KW_DELETE=231
KW_DISTINCT=232 KW_DESCRIBE=232
KW_DOUBLE=233 KW_DISTINCT=233
KW_DROP=234 KW_DOUBLE=234
KW_EACH=235 KW_DROP=235
KW_ELSE=236 KW_EACH=236
KW_END=237 KW_ELSE=237
KW_EQUALS=238 KW_END=238
KW_EXCEPT=239 KW_EQUALS=239
KW_EXECUTE=240 KW_ESCAPE=240
KW_EXISTS=241 KW_EXCEPT=241
KW_EXPLAIN=242 KW_EXECUTE=242
KW_EXTERNAL=243 KW_EXISTS=243
KW_EXTRACT=244 KW_EXPLAIN=244
KW_FALSE=245 KW_EXTERNAL=245
KW_FLOAT=246 KW_EXTRACT=246
KW_FOR=247 KW_FALSE=247
KW_FROM=248 KW_FLOAT=248
KW_FULL=249 KW_FOR=249
KW_FUNCTION=250 KW_FROM=250
KW_GLOBAL=251 KW_FULL=251
KW_GRANT=252 KW_FUNCTION=252
KW_GROUP=253 KW_GLOBAL=253
KW_GROUPING=254 KW_GRANT=254
KW_GROUPS=255 KW_GROUP=255
KW_HAVING=256 KW_GROUPING=256
KW_HOUR=257 KW_GROUPS=257
KW_IMPORT=258 KW_HAVING=258
KW_IN=259 KW_HOUR=259
KW_INCLUDING=260 KW_IMPORT=260
KW_INNER=261 KW_IN=261
KW_INOUT=262 KW_INCLUDING=262
KW_INSERT=263 KW_INNER=263
KW_INT=264 KW_INOUT=264
KW_INTEGER=265 KW_INSERT=265
KW_INTERSECT=266 KW_INT=266
KW_INTERVAL=267 KW_INTEGER=267
KW_INTO=268 KW_INTERSECT=268
KW_IS=269 KW_INTERVAL=269
KW_JOIN=270 KW_INTO=270
KW_LAG=271 KW_IS=271
KW_LANGUAGE=272 KW_JOIN=272
KW_LATERAL=273 KW_LAG=273
KW_LEADING=274 KW_LANGUAGE=274
KW_LEFT=275 KW_LATERAL=275
KW_LIKE=276 KW_LEADING=276
KW_LIMIT=277 KW_LEFT=277
KW_LOCAL=278 KW_LIKE=278
KW_MATCH=279 KW_LIMIT=279
KW_MATCH_RECOGNIZE=280 KW_LOCAL=280
KW_MEASURES=281 KW_MATCH=281
KW_MERGE=282 KW_MATCH_RECOGNIZE=282
KW_METADATA=283 KW_MEASURES=283
KW_MINUS=284 KW_MERGE=284
KW_MINUTE=285 KW_METADATA=285
KW_MODIFIES=286 KW_MINUS=286
KW_MODULE=287 KW_MINUTE=287
KW_MONTH=288 KW_MODIFIES=288
KW_MULTISET=289 KW_MODULE=289
KW_NATURAL=290 KW_MONTH=290
KW_NEXT=291 KW_MULTISET=291
KW_NO=292 KW_NATURAL=292
KW_NONE=293 KW_NEXT=293
KW_NOT=294 KW_NO=294
KW_NULL=295 KW_NONE=295
KW_NUMERIC=296 KW_NOT=296
KW_OF=297 KW_NULL=297
KW_OFFSET=298 KW_NUMERIC=298
KW_ON=299 KW_OF=299
KW_ONE=300 KW_OFFSET=300
KW_OR=301 KW_ON=301
KW_ORDER=302 KW_ONE=302
KW_OUT=303 KW_OR=303
KW_OUTER=304 KW_ORDER=304
KW_OVER=305 KW_OUT=305
KW_OVERLAY=306 KW_OUTER=306
KW_PARTITION=307 KW_OVER=307
KW_PATTERN=308 KW_OVERLAY=308
KW_PER=309 KW_PARTITION=309
KW_PERCENT=310 KW_PATTERN=310
KW_PERIOD=311 KW_PER=311
KW_POSITION=312 KW_PERCENT=312
KW_PRIMARY=313 KW_PERIOD=313
KW_RANGE=314 KW_POSITION=314
KW_RANK=315 KW_POWER=315
KW_RESET=316 KW_PRIMARY=316
KW_REVOKE=317 KW_RANGE=317
KW_RIGHT=318 KW_RANK=318
KW_RLIKE=319 KW_RESET=319
KW_ROLLBACK=320 KW_REVOKE=320
KW_ROLLUP=321 KW_RIGHT=321
KW_ROW=322 KW_RLIKE=322
KW_ROWS=323 KW_ROLLBACK=323
KW_SECOND=324 KW_ROLLUP=324
KW_SELECT=325 KW_ROW=325
KW_SET=326 KW_ROWS=326
KW_SHOW=327 KW_SECOND=327
KW_SKIP=328 KW_SELECT=328
KW_SMALLINT=329 KW_SET=329
KW_START=330 KW_SHOW=330
KW_STATIC=331 KW_SIMILAR=331
KW_SUBSTRING=332 KW_SKIP=332
KW_SUM=333 KW_SMALLINT=333
KW_SYSTEM=334 KW_START=334
KW_SYSTEM_TIME=335 KW_STATIC=335
KW_SYSTEM_USER=336 KW_SUBSTRING=336
KW_TABLE=337 KW_SUM=337
KW_TABLESAMPLE=338 KW_SYMMETRIC=338
KW_THEN=339 KW_SYSTEM=339
KW_TIME=340 KW_SYSTEM_TIME=340
KW_TIMESTAMP=341 KW_SYSTEM_USER=341
KW_TINYINT=342 KW_TABLE=342
KW_TO=343 KW_TABLESAMPLE=343
KW_TRUE=344 KW_THEN=344
KW_TRUNCATE=345 KW_TIME=345
KW_UNION=346 KW_TIMESTAMP=346
KW_UNIQUE=347 KW_TINYINT=347
KW_UNKNOWN=348 KW_TO=348
KW_UNNEST=349 KW_TRUE=349
KW_UPPER=350 KW_TRUNCATE=350
KW_UPSERT=351 KW_UNION=351
KW_USER=352 KW_UNIQUE=352
KW_USING=353 KW_UNKNOWN=353
KW_VALUE=354 KW_UNNEST=354
KW_VALUES=355 KW_UPPER=355
KW_VARBINARY=356 KW_UPSERT=356
KW_VARCHAR=357 KW_USER=357
KW_WHEN=358 KW_USING=358
KW_WHERE=359 KW_VALUE=359
KW_WINDOW=360 KW_VALUES=360
KW_WITH=361 KW_VARBINARY=361
KW_WITHIN=362 KW_VARCHAR=362
KW_WITHOUT=363 KW_WHEN=363
KW_YEAR=364 KW_WHERE=364
EQUAL_SYMBOL=365 KW_WINDOW=365
GREATER_SYMBOL=366 KW_WITH=366
LESS_SYMBOL=367 KW_WITHIN=367
EXCLAMATION_SYMBOL=368 KW_WITHOUT=368
BIT_NOT_OP=369 KW_YEAR=369
BIT_OR_OP=370 EQUAL_SYMBOL=370
BIT_AND_OP=371 GREATER_SYMBOL=371
BIT_XOR_OP=372 LESS_SYMBOL=372
DOT=373 EXCLAMATION_SYMBOL=373
LS_BRACKET=374 BIT_NOT_OP=374
RS_BRACKET=375 BIT_OR_OP=375
LR_BRACKET=376 BIT_AND_OP=376
RR_BRACKET=377 BIT_XOR_OP=377
LB_BRACKET=378 DOT=378
RB_BRACKET=379 LS_BRACKET=379
COMMA=380 RS_BRACKET=380
SEMICOLON=381 LR_BRACKET=381
AT_SIGN=382 RR_BRACKET=382
SINGLE_QUOTE_SYMB=383 LB_BRACKET=383
DOUBLE_QUOTE_SYMB=384 RB_BRACKET=384
REVERSE_QUOTE_SYMB=385 COMMA=385
COLON_SYMB=386 SEMICOLON=386
ASTERISK_SIGN=387 AT_SIGN=387
UNDERLINE_SIGN=388 SINGLE_QUOTE_SYMB=388
HYPNEN_SIGN=389 DOUBLE_QUOTE_SYMB=389
ADD_SIGN=390 REVERSE_QUOTE_SYMB=390
PENCENT_SIGN=391 COLON_SYMB=391
DOUBLE_VERTICAL_SIGN=392 ASTERISK_SIGN=392
DOUBLE_HYPNEN_SIGN=393 UNDERLINE_SIGN=393
SLASH_SIGN=394 HYPNEN_SIGN=394
QUESTION_MARK_SIGN=395 ADD_SIGN=395
DOUBLE_RIGHT_ARROW=396 PENCENT_SIGN=396
STRING_LITERAL=397 DOUBLE_VERTICAL_SIGN=397
DIG_LITERAL=398 DOUBLE_HYPNEN_SIGN=398
REAL_LITERAL=399 SLASH_SIGN=399
BIT_STRING=400 QUESTION_MARK_SIGN=400
ID_LITERAL=401 DOUBLE_RIGHT_ARROW=401
FILE_PATH=402 STRING_LITERAL=402
DIG_LITERAL=403
REAL_LITERAL=404
BIT_STRING=405
ID_LITERAL=406
FILE_PATH=407
'ADD'=4 'ADD'=4
'ADMIN'=5 'ADMIN'=5
'AFTER'=6 'AFTER'=6
@ -580,216 +585,221 @@ FILE_PATH=402
'ARE'=181 'ARE'=181
'ARRAY'=182 'ARRAY'=182
'AS'=183 'AS'=183
'AT'=184 'ASYMMETRIC'=184
'AVG'=185 'AT'=185
'BEGIN'=186 'AVG'=186
'BETWEEN'=187 'BEGIN'=187
'BIGINT'=188 'BETWEEN'=188
'BINARY'=189 'BIGINT'=189
'BIT'=190 'BINARY'=190
'BLOB'=191 'BIT'=191
'BOOLEAN'=192 'BLOB'=192
'BOTH'=193 'BOOLEAN'=193
'BY'=194 'BOTH'=194
'CALL'=195 'BY'=195
'CALLED'=196 'CALL'=196
'CASCADED'=197 'CALLED'=197
'CASE'=198 'CASCADED'=198
'CAST'=199 'CASE'=199
'CEIL'=200 'CAST'=200
'CHAR'=201 'CEIL'=201
'CHARACTER'=202 'CHAR'=202
'CHECK'=203 'CHARACTER'=203
'CLOB'=204 'CHECK'=204
'CLOSE'=205 'CLOB'=205
'COALESCE'=206 'CLOSE'=206
'COLLATE'=207 'COALESCE'=207
'COLLECT'=208 'COLLATE'=208
'COLUMN'=209 'COLLECT'=209
'COMMIT'=210 'COLUMN'=210
'CONNECT'=211 'COMMIT'=211
'CONSTRAINT'=212 'CONNECT'=212
'CONTAINS'=213 'CONSTRAINT'=213
'CONVERT'=214 'CONTAINS'=214
'COUNT'=215 'CONVERT'=215
'CREATE'=216 'COUNT'=216
'CROSS'=217 'CREATE'=217
'CUBE'=218 'CROSS'=218
'CURRENT'=219 'CUBE'=219
'CURSOR'=220 'CURRENT'=220
'CYCLE'=221 'CURSOR'=221
'DATE'=222 'CYCLE'=222
'DATETIME'=223 'DATE'=223
'DAY'=224 'DATETIME'=224
'DEC'=225 'DAY'=225
'DECIMAL'=226 'DEC'=226
'DECLARE'=227 'DECIMAL'=227
'DEFAULT'=228 'DECLARE'=228
'DEFINE'=229 'DEFAULT'=229
'DELETE'=230 'DEFINE'=230
'DESCRIBE'=231 'DELETE'=231
'DISTINCT'=232 'DESCRIBE'=232
'DOUBLE'=233 'DISTINCT'=233
'DROP'=234 'DOUBLE'=234
'EACH'=235 'DROP'=235
'ELSE'=236 'EACH'=236
'END'=237 'ELSE'=237
'EQUALS'=238 'END'=238
'EXCEPT'=239 'EQUALS'=239
'EXECUTE'=240 'ESCAPE'=240
'EXISTS'=241 'EXCEPT'=241
'EXPLAIN'=242 'EXECUTE'=242
'EXTERNAL'=243 'EXISTS'=243
'EXTRACT'=244 'EXPLAIN'=244
'FALSE'=245 'EXTERNAL'=245
'FLOAT'=246 'EXTRACT'=246
'FOR'=247 'FALSE'=247
'FROM'=248 'FLOAT'=248
'FULL'=249 'FOR'=249
'FUNCTION'=250 'FROM'=250
'GLOBAL'=251 'FULL'=251
'GRANT'=252 'FUNCTION'=252
'GROUP'=253 'GLOBAL'=253
'GROUPING'=254 'GRANT'=254
'GROUPS'=255 'GROUP'=255
'HAVING'=256 'GROUPING'=256
'HOUR'=257 'GROUPS'=257
'IMPORT'=258 'HAVING'=258
'IN'=259 'HOUR'=259
'INCLUDING'=260 'IMPORT'=260
'INNER'=261 'IN'=261
'INOUT'=262 'INCLUDING'=262
'INSERT'=263 'INNER'=263
'INT'=264 'INOUT'=264
'INTEGER'=265 'INSERT'=265
'INTERSECT'=266 'INT'=266
'INTERVAL'=267 'INTEGER'=267
'INTO'=268 'INTERSECT'=268
'IS'=269 'INTERVAL'=269
'JOIN'=270 'INTO'=270
'LAG'=271 'IS'=271
'LANGUAGE'=272 'JOIN'=272
'LATERAL'=273 'LAG'=273
'LEADING'=274 'LANGUAGE'=274
'LEFT'=275 'LATERAL'=275
'LIKE'=276 'LEADING'=276
'LIMIT'=277 'LEFT'=277
'LOCAL'=278 'LIKE'=278
'MATCH'=279 'LIMIT'=279
'MATCH_RECOGNIZE'=280 'LOCAL'=280
'MEASURES'=281 'MATCH'=281
'MERGE'=282 'MATCH_RECOGNIZE'=282
'METADATA'=283 'MEASURES'=283
'MINUS'=284 'MERGE'=284
'MINUTE'=285 'METADATA'=285
'MODIFIES'=286 'MINUS'=286
'MODULE'=287 'MINUTE'=287
'MONTH'=288 'MODIFIES'=288
'MULTISET'=289 'MODULE'=289
'NATURAL'=290 'MONTH'=290
'NEXT'=291 'MULTISET'=291
'NO'=292 'NATURAL'=292
'NONE'=293 'NEXT'=293
'NOT'=294 'NO'=294
'NULL'=295 'NONE'=295
'NUMERIC'=296 'NOT'=296
'OF'=297 'NULL'=297
'OFFSET'=298 'NUMERIC'=298
'ON'=299 'OF'=299
'ONE'=300 'OFFSET'=300
'OR'=301 'ON'=301
'ORDER'=302 'ONE'=302
'OUT'=303 'OR'=303
'OUTER'=304 'ORDER'=304
'OVER'=305 'OUT'=305
'OVERLAY'=306 'OUTER'=306
'PARTITION'=307 'OVER'=307
'PATTERN'=308 'OVERLAY'=308
'PER'=309 'PARTITION'=309
'PERCENT'=310 'PATTERN'=310
'PERIOD'=311 'PER'=311
'POSITION'=312 'PERCENT'=312
'PRIMARY'=313 'PERIOD'=313
'RANGE'=314 'POSITION'=314
'RANK'=315 'POWER'=315
'RESET'=316 'PRIMARY'=316
'REVOKE'=317 'RANGE'=317
'RIGHT'=318 'RANK'=318
'RLIKE'=319 'RESET'=319
'ROLLBACK'=320 'REVOKE'=320
'ROLLUP'=321 'RIGHT'=321
'ROW'=322 'RLIKE'=322
'ROWS'=323 'ROLLBACK'=323
'SECOND'=324 'ROLLUP'=324
'SELECT'=325 'ROW'=325
'SET'=326 'ROWS'=326
'SHOW'=327 'SECOND'=327
'SKIP'=328 'SELECT'=328
'SMALLINT'=329 'SET'=329
'START'=330 'SHOW'=330
'STATIC'=331 'SIMILAR'=331
'SUBSTRING'=332 'SKIP'=332
'SUM'=333 'SMALLINT'=333
'SYSTEM'=334 'START'=334
'SYSTEM_TIME'=335 'STATIC'=335
'SYSTEM_USER'=336 'SUBSTRING'=336
'TABLE'=337 'SUM'=337
'TABLESAMPLE'=338 'SYMMETRIC'=338
'THEN'=339 'SYSTEM'=339
'TIME'=340 'SYSTEM_TIME'=340
'TIMESTAMP'=341 'SYSTEM_USER'=341
'TINYINT'=342 'TABLE'=342
'TO'=343 'TABLESAMPLE'=343
'TRUE'=344 'THEN'=344
'TRUNCATE'=345 'TIME'=345
'UNION'=346 'TIMESTAMP'=346
'UNIQUE'=347 'TINYINT'=347
'UNKNOWN'=348 'TO'=348
'UNNEST'=349 'TRUE'=349
'UPPER'=350 'TRUNCATE'=350
'UPSERT'=351 'UNION'=351
'USER'=352 'UNIQUE'=352
'USING'=353 'UNKNOWN'=353
'VALUE'=354 'UNNEST'=354
'VALUES'=355 'UPPER'=355
'VARBINARY'=356 'UPSERT'=356
'VARCHAR'=357 'USER'=357
'WHEN'=358 'USING'=358
'WHERE'=359 'VALUE'=359
'WINDOW'=360 'VALUES'=360
'WITH'=361 'VARBINARY'=361
'WITHIN'=362 'VARCHAR'=362
'WITHOUT'=363 'WHEN'=363
'YEAR'=364 'WHERE'=364
'='=365 'WINDOW'=365
'>'=366 'WITH'=366
'<'=367 'WITHIN'=367
'!'=368 'WITHOUT'=368
'~'=369 'YEAR'=369
'|'=370 '='=370
'&'=371 '>'=371
'^'=372 '<'=372
'.'=373 '!'=373
'['=374 '~'=374
']'=375 '|'=375
'('=376 '&'=376
')'=377 '^'=377
'{'=378 '.'=378
'}'=379 '['=379
','=380 ']'=380
';'=381 '('=381
'@'=382 ')'=382
'\''=383 '{'=383
'"'=384 '}'=384
'`'=385 ','=385
':'=386 ';'=386
'*'=387 '@'=387
'_'=388 '\''=388
'-'=389 '"'=389
'+'=390 '`'=390
'%'=391 ':'=391
'||'=392 '*'=392
'--'=393 '_'=393
'/'=394 '-'=394
'?'=395 '+'=395
'=>'=396 '%'=396
'||'=397
'--'=398
'/'=399
'?'=400
'=>'=401

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -174,232 +174,237 @@ KW_YEARS=173
KW_ZONE=174 KW_ZONE=174
KW_ABS=175 KW_ABS=175
KW_ALL=176 KW_ALL=176
ALLOW=177 KW_ALLOW=177
KW_ALTER=178 KW_ALTER=178
KW_AND=179 KW_AND=179
KW_ANY=180 KW_ANY=180
KW_ARE=181 KW_ARE=181
KW_ARRAY=182 KW_ARRAY=182
KW_AS=183 KW_AS=183
KW_AT=184 KW_ASYMMETRIC=184
KW_AVG=185 KW_AT=185
KW_BEGIN=186 KW_AVG=186
KW_BETWEEN=187 KW_BEGIN=187
KW_BIGINT=188 KW_BETWEEN=188
KW_BINARY=189 KW_BIGINT=189
KW_BIT=190 KW_BINARY=190
KW_BLOB=191 KW_BIT=191
KW_BOOLEAN=192 KW_BLOB=192
KW_BOTH=193 KW_BOOLEAN=193
KW_BY=194 KW_BOTH=194
KW_CALL=195 KW_BY=195
KW_CALLED=196 KW_CALL=196
KW_CASCADED=197 KW_CALLED=197
KW_CASE=198 KW_CASCADED=198
KW_CAST=199 KW_CASE=199
KW_CEIL=200 KW_CAST=200
KW_CHAR=201 KW_CEIL=201
KW_CHARACTER=202 KW_CHAR=202
KW_CHECK=203 KW_CHARACTER=203
KW_CLOB=204 KW_CHECK=204
KW_CLOSE=205 KW_CLOB=205
KW_COALESCE=206 KW_CLOSE=206
KW_COLLATE=207 KW_COALESCE=207
KW_COLLECT=208 KW_COLLATE=208
KW_COLUMN=209 KW_COLLECT=209
KW_COMMIT=210 KW_COLUMN=210
KW_CONNECT=211 KW_COMMIT=211
KW_CONSTRAINT=212 KW_CONNECT=212
KW_CONTAINS=213 KW_CONSTRAINT=213
KW_CONVERT=214 KW_CONTAINS=214
KW_COUNT=215 KW_CONVERT=215
KW_CREATE=216 KW_COUNT=216
KW_CROSS=217 KW_CREATE=217
KW_CUBE=218 KW_CROSS=218
KW_CURRENT=219 KW_CUBE=219
KW_CURSOR=220 KW_CURRENT=220
KW_CYCLE=221 KW_CURSOR=221
KW_DATE=222 KW_CYCLE=222
KW_DATETIME=223 KW_DATE=223
KW_DAY=224 KW_DATETIME=224
KW_DEC=225 KW_DAY=225
KW_DECIMAL=226 KW_DEC=226
KW_DECLARE=227 KW_DECIMAL=227
KW_DEFAULT=228 KW_DECLARE=228
KW_DEFINE=229 KW_DEFAULT=229
KW_DELETE=230 KW_DEFINE=230
KW_DESCRIBE=231 KW_DELETE=231
KW_DISTINCT=232 KW_DESCRIBE=232
KW_DOUBLE=233 KW_DISTINCT=233
KW_DROP=234 KW_DOUBLE=234
KW_EACH=235 KW_DROP=235
KW_ELSE=236 KW_EACH=236
KW_END=237 KW_ELSE=237
KW_EQUALS=238 KW_END=238
KW_EXCEPT=239 KW_EQUALS=239
KW_EXECUTE=240 KW_ESCAPE=240
KW_EXISTS=241 KW_EXCEPT=241
KW_EXPLAIN=242 KW_EXECUTE=242
KW_EXTERNAL=243 KW_EXISTS=243
KW_EXTRACT=244 KW_EXPLAIN=244
KW_FALSE=245 KW_EXTERNAL=245
KW_FLOAT=246 KW_EXTRACT=246
KW_FOR=247 KW_FALSE=247
KW_FROM=248 KW_FLOAT=248
KW_FULL=249 KW_FOR=249
KW_FUNCTION=250 KW_FROM=250
KW_GLOBAL=251 KW_FULL=251
KW_GRANT=252 KW_FUNCTION=252
KW_GROUP=253 KW_GLOBAL=253
KW_GROUPING=254 KW_GRANT=254
KW_GROUPS=255 KW_GROUP=255
KW_HAVING=256 KW_GROUPING=256
KW_HOUR=257 KW_GROUPS=257
KW_IMPORT=258 KW_HAVING=258
KW_IN=259 KW_HOUR=259
KW_INCLUDING=260 KW_IMPORT=260
KW_INNER=261 KW_IN=261
KW_INOUT=262 KW_INCLUDING=262
KW_INSERT=263 KW_INNER=263
KW_INT=264 KW_INOUT=264
KW_INTEGER=265 KW_INSERT=265
KW_INTERSECT=266 KW_INT=266
KW_INTERVAL=267 KW_INTEGER=267
KW_INTO=268 KW_INTERSECT=268
KW_IS=269 KW_INTERVAL=269
KW_JOIN=270 KW_INTO=270
KW_LAG=271 KW_IS=271
KW_LANGUAGE=272 KW_JOIN=272
KW_LATERAL=273 KW_LAG=273
KW_LEADING=274 KW_LANGUAGE=274
KW_LEFT=275 KW_LATERAL=275
KW_LIKE=276 KW_LEADING=276
KW_LIMIT=277 KW_LEFT=277
KW_LOCAL=278 KW_LIKE=278
KW_MATCH=279 KW_LIMIT=279
KW_MATCH_RECOGNIZE=280 KW_LOCAL=280
KW_MEASURES=281 KW_MATCH=281
KW_MERGE=282 KW_MATCH_RECOGNIZE=282
KW_METADATA=283 KW_MEASURES=283
KW_MINUS=284 KW_MERGE=284
KW_MINUTE=285 KW_METADATA=285
KW_MODIFIES=286 KW_MINUS=286
KW_MODULE=287 KW_MINUTE=287
KW_MONTH=288 KW_MODIFIES=288
KW_MULTISET=289 KW_MODULE=289
KW_NATURAL=290 KW_MONTH=290
KW_NEXT=291 KW_MULTISET=291
KW_NO=292 KW_NATURAL=292
KW_NONE=293 KW_NEXT=293
KW_NOT=294 KW_NO=294
KW_NULL=295 KW_NONE=295
KW_NUMERIC=296 KW_NOT=296
KW_OF=297 KW_NULL=297
KW_OFFSET=298 KW_NUMERIC=298
KW_ON=299 KW_OF=299
KW_ONE=300 KW_OFFSET=300
KW_OR=301 KW_ON=301
KW_ORDER=302 KW_ONE=302
KW_OUT=303 KW_OR=303
KW_OUTER=304 KW_ORDER=304
KW_OVER=305 KW_OUT=305
KW_OVERLAY=306 KW_OUTER=306
KW_PARTITION=307 KW_OVER=307
KW_PATTERN=308 KW_OVERLAY=308
KW_PER=309 KW_PARTITION=309
KW_PERCENT=310 KW_PATTERN=310
KW_PERIOD=311 KW_PER=311
KW_POSITION=312 KW_PERCENT=312
KW_PRIMARY=313 KW_PERIOD=313
KW_RANGE=314 KW_POSITION=314
KW_RANK=315 KW_POWER=315
KW_RESET=316 KW_PRIMARY=316
KW_REVOKE=317 KW_RANGE=317
KW_RIGHT=318 KW_RANK=318
KW_RLIKE=319 KW_RESET=319
KW_ROLLBACK=320 KW_REVOKE=320
KW_ROLLUP=321 KW_RIGHT=321
KW_ROW=322 KW_RLIKE=322
KW_ROWS=323 KW_ROLLBACK=323
KW_SECOND=324 KW_ROLLUP=324
KW_SELECT=325 KW_ROW=325
KW_SET=326 KW_ROWS=326
KW_SHOW=327 KW_SECOND=327
KW_SKIP=328 KW_SELECT=328
KW_SMALLINT=329 KW_SET=329
KW_START=330 KW_SHOW=330
KW_STATIC=331 KW_SIMILAR=331
KW_SUBSTRING=332 KW_SKIP=332
KW_SUM=333 KW_SMALLINT=333
KW_SYSTEM=334 KW_START=334
KW_SYSTEM_TIME=335 KW_STATIC=335
KW_SYSTEM_USER=336 KW_SUBSTRING=336
KW_TABLE=337 KW_SUM=337
KW_TABLESAMPLE=338 KW_SYMMETRIC=338
KW_THEN=339 KW_SYSTEM=339
KW_TIME=340 KW_SYSTEM_TIME=340
KW_TIMESTAMP=341 KW_SYSTEM_USER=341
KW_TINYINT=342 KW_TABLE=342
KW_TO=343 KW_TABLESAMPLE=343
KW_TRUE=344 KW_THEN=344
KW_TRUNCATE=345 KW_TIME=345
KW_UNION=346 KW_TIMESTAMP=346
KW_UNIQUE=347 KW_TINYINT=347
KW_UNKNOWN=348 KW_TO=348
KW_UNNEST=349 KW_TRUE=349
KW_UPPER=350 KW_TRUNCATE=350
KW_UPSERT=351 KW_UNION=351
KW_USER=352 KW_UNIQUE=352
KW_USING=353 KW_UNKNOWN=353
KW_VALUE=354 KW_UNNEST=354
KW_VALUES=355 KW_UPPER=355
KW_VARBINARY=356 KW_UPSERT=356
KW_VARCHAR=357 KW_USER=357
KW_WHEN=358 KW_USING=358
KW_WHERE=359 KW_VALUE=359
KW_WINDOW=360 KW_VALUES=360
KW_WITH=361 KW_VARBINARY=361
KW_WITHIN=362 KW_VARCHAR=362
KW_WITHOUT=363 KW_WHEN=363
KW_YEAR=364 KW_WHERE=364
EQUAL_SYMBOL=365 KW_WINDOW=365
GREATER_SYMBOL=366 KW_WITH=366
LESS_SYMBOL=367 KW_WITHIN=367
EXCLAMATION_SYMBOL=368 KW_WITHOUT=368
BIT_NOT_OP=369 KW_YEAR=369
BIT_OR_OP=370 EQUAL_SYMBOL=370
BIT_AND_OP=371 GREATER_SYMBOL=371
BIT_XOR_OP=372 LESS_SYMBOL=372
DOT=373 EXCLAMATION_SYMBOL=373
LS_BRACKET=374 BIT_NOT_OP=374
RS_BRACKET=375 BIT_OR_OP=375
LR_BRACKET=376 BIT_AND_OP=376
RR_BRACKET=377 BIT_XOR_OP=377
LB_BRACKET=378 DOT=378
RB_BRACKET=379 LS_BRACKET=379
COMMA=380 RS_BRACKET=380
SEMICOLON=381 LR_BRACKET=381
AT_SIGN=382 RR_BRACKET=382
SINGLE_QUOTE_SYMB=383 LB_BRACKET=383
DOUBLE_QUOTE_SYMB=384 RB_BRACKET=384
REVERSE_QUOTE_SYMB=385 COMMA=385
COLON_SYMB=386 SEMICOLON=386
ASTERISK_SIGN=387 AT_SIGN=387
UNDERLINE_SIGN=388 SINGLE_QUOTE_SYMB=388
HYPNEN_SIGN=389 DOUBLE_QUOTE_SYMB=389
ADD_SIGN=390 REVERSE_QUOTE_SYMB=390
PENCENT_SIGN=391 COLON_SYMB=391
DOUBLE_VERTICAL_SIGN=392 ASTERISK_SIGN=392
DOUBLE_HYPNEN_SIGN=393 UNDERLINE_SIGN=393
SLASH_SIGN=394 HYPNEN_SIGN=394
QUESTION_MARK_SIGN=395 ADD_SIGN=395
DOUBLE_RIGHT_ARROW=396 PENCENT_SIGN=396
STRING_LITERAL=397 DOUBLE_VERTICAL_SIGN=397
DIG_LITERAL=398 DOUBLE_HYPNEN_SIGN=398
REAL_LITERAL=399 SLASH_SIGN=399
BIT_STRING=400 QUESTION_MARK_SIGN=400
ID_LITERAL=401 DOUBLE_RIGHT_ARROW=401
FILE_PATH=402 STRING_LITERAL=402
DIG_LITERAL=403
REAL_LITERAL=404
BIT_STRING=405
ID_LITERAL=406
FILE_PATH=407
'ADD'=4 'ADD'=4
'ADMIN'=5 'ADMIN'=5
'AFTER'=6 'AFTER'=6
@ -580,216 +585,221 @@ FILE_PATH=402
'ARE'=181 'ARE'=181
'ARRAY'=182 'ARRAY'=182
'AS'=183 'AS'=183
'AT'=184 'ASYMMETRIC'=184
'AVG'=185 'AT'=185
'BEGIN'=186 'AVG'=186
'BETWEEN'=187 'BEGIN'=187
'BIGINT'=188 'BETWEEN'=188
'BINARY'=189 'BIGINT'=189
'BIT'=190 'BINARY'=190
'BLOB'=191 'BIT'=191
'BOOLEAN'=192 'BLOB'=192
'BOTH'=193 'BOOLEAN'=193
'BY'=194 'BOTH'=194
'CALL'=195 'BY'=195
'CALLED'=196 'CALL'=196
'CASCADED'=197 'CALLED'=197
'CASE'=198 'CASCADED'=198
'CAST'=199 'CASE'=199
'CEIL'=200 'CAST'=200
'CHAR'=201 'CEIL'=201
'CHARACTER'=202 'CHAR'=202
'CHECK'=203 'CHARACTER'=203
'CLOB'=204 'CHECK'=204
'CLOSE'=205 'CLOB'=205
'COALESCE'=206 'CLOSE'=206
'COLLATE'=207 'COALESCE'=207
'COLLECT'=208 'COLLATE'=208
'COLUMN'=209 'COLLECT'=209
'COMMIT'=210 'COLUMN'=210
'CONNECT'=211 'COMMIT'=211
'CONSTRAINT'=212 'CONNECT'=212
'CONTAINS'=213 'CONSTRAINT'=213
'CONVERT'=214 'CONTAINS'=214
'COUNT'=215 'CONVERT'=215
'CREATE'=216 'COUNT'=216
'CROSS'=217 'CREATE'=217
'CUBE'=218 'CROSS'=218
'CURRENT'=219 'CUBE'=219
'CURSOR'=220 'CURRENT'=220
'CYCLE'=221 'CURSOR'=221
'DATE'=222 'CYCLE'=222
'DATETIME'=223 'DATE'=223
'DAY'=224 'DATETIME'=224
'DEC'=225 'DAY'=225
'DECIMAL'=226 'DEC'=226
'DECLARE'=227 'DECIMAL'=227
'DEFAULT'=228 'DECLARE'=228
'DEFINE'=229 'DEFAULT'=229
'DELETE'=230 'DEFINE'=230
'DESCRIBE'=231 'DELETE'=231
'DISTINCT'=232 'DESCRIBE'=232
'DOUBLE'=233 'DISTINCT'=233
'DROP'=234 'DOUBLE'=234
'EACH'=235 'DROP'=235
'ELSE'=236 'EACH'=236
'END'=237 'ELSE'=237
'EQUALS'=238 'END'=238
'EXCEPT'=239 'EQUALS'=239
'EXECUTE'=240 'ESCAPE'=240
'EXISTS'=241 'EXCEPT'=241
'EXPLAIN'=242 'EXECUTE'=242
'EXTERNAL'=243 'EXISTS'=243
'EXTRACT'=244 'EXPLAIN'=244
'FALSE'=245 'EXTERNAL'=245
'FLOAT'=246 'EXTRACT'=246
'FOR'=247 'FALSE'=247
'FROM'=248 'FLOAT'=248
'FULL'=249 'FOR'=249
'FUNCTION'=250 'FROM'=250
'GLOBAL'=251 'FULL'=251
'GRANT'=252 'FUNCTION'=252
'GROUP'=253 'GLOBAL'=253
'GROUPING'=254 'GRANT'=254
'GROUPS'=255 'GROUP'=255
'HAVING'=256 'GROUPING'=256
'HOUR'=257 'GROUPS'=257
'IMPORT'=258 'HAVING'=258
'IN'=259 'HOUR'=259
'INCLUDING'=260 'IMPORT'=260
'INNER'=261 'IN'=261
'INOUT'=262 'INCLUDING'=262
'INSERT'=263 'INNER'=263
'INT'=264 'INOUT'=264
'INTEGER'=265 'INSERT'=265
'INTERSECT'=266 'INT'=266
'INTERVAL'=267 'INTEGER'=267
'INTO'=268 'INTERSECT'=268
'IS'=269 'INTERVAL'=269
'JOIN'=270 'INTO'=270
'LAG'=271 'IS'=271
'LANGUAGE'=272 'JOIN'=272
'LATERAL'=273 'LAG'=273
'LEADING'=274 'LANGUAGE'=274
'LEFT'=275 'LATERAL'=275
'LIKE'=276 'LEADING'=276
'LIMIT'=277 'LEFT'=277
'LOCAL'=278 'LIKE'=278
'MATCH'=279 'LIMIT'=279
'MATCH_RECOGNIZE'=280 'LOCAL'=280
'MEASURES'=281 'MATCH'=281
'MERGE'=282 'MATCH_RECOGNIZE'=282
'METADATA'=283 'MEASURES'=283
'MINUS'=284 'MERGE'=284
'MINUTE'=285 'METADATA'=285
'MODIFIES'=286 'MINUS'=286
'MODULE'=287 'MINUTE'=287
'MONTH'=288 'MODIFIES'=288
'MULTISET'=289 'MODULE'=289
'NATURAL'=290 'MONTH'=290
'NEXT'=291 'MULTISET'=291
'NO'=292 'NATURAL'=292
'NONE'=293 'NEXT'=293
'NOT'=294 'NO'=294
'NULL'=295 'NONE'=295
'NUMERIC'=296 'NOT'=296
'OF'=297 'NULL'=297
'OFFSET'=298 'NUMERIC'=298
'ON'=299 'OF'=299
'ONE'=300 'OFFSET'=300
'OR'=301 'ON'=301
'ORDER'=302 'ONE'=302
'OUT'=303 'OR'=303
'OUTER'=304 'ORDER'=304
'OVER'=305 'OUT'=305
'OVERLAY'=306 'OUTER'=306
'PARTITION'=307 'OVER'=307
'PATTERN'=308 'OVERLAY'=308
'PER'=309 'PARTITION'=309
'PERCENT'=310 'PATTERN'=310
'PERIOD'=311 'PER'=311
'POSITION'=312 'PERCENT'=312
'PRIMARY'=313 'PERIOD'=313
'RANGE'=314 'POSITION'=314
'RANK'=315 'POWER'=315
'RESET'=316 'PRIMARY'=316
'REVOKE'=317 'RANGE'=317
'RIGHT'=318 'RANK'=318
'RLIKE'=319 'RESET'=319
'ROLLBACK'=320 'REVOKE'=320
'ROLLUP'=321 'RIGHT'=321
'ROW'=322 'RLIKE'=322
'ROWS'=323 'ROLLBACK'=323
'SECOND'=324 'ROLLUP'=324
'SELECT'=325 'ROW'=325
'SET'=326 'ROWS'=326
'SHOW'=327 'SECOND'=327
'SKIP'=328 'SELECT'=328
'SMALLINT'=329 'SET'=329
'START'=330 'SHOW'=330
'STATIC'=331 'SIMILAR'=331
'SUBSTRING'=332 'SKIP'=332
'SUM'=333 'SMALLINT'=333
'SYSTEM'=334 'START'=334
'SYSTEM_TIME'=335 'STATIC'=335
'SYSTEM_USER'=336 'SUBSTRING'=336
'TABLE'=337 'SUM'=337
'TABLESAMPLE'=338 'SYMMETRIC'=338
'THEN'=339 'SYSTEM'=339
'TIME'=340 'SYSTEM_TIME'=340
'TIMESTAMP'=341 'SYSTEM_USER'=341
'TINYINT'=342 'TABLE'=342
'TO'=343 'TABLESAMPLE'=343
'TRUE'=344 'THEN'=344
'TRUNCATE'=345 'TIME'=345
'UNION'=346 'TIMESTAMP'=346
'UNIQUE'=347 'TINYINT'=347
'UNKNOWN'=348 'TO'=348
'UNNEST'=349 'TRUE'=349
'UPPER'=350 'TRUNCATE'=350
'UPSERT'=351 'UNION'=351
'USER'=352 'UNIQUE'=352
'USING'=353 'UNKNOWN'=353
'VALUE'=354 'UNNEST'=354
'VALUES'=355 'UPPER'=355
'VARBINARY'=356 'UPSERT'=356
'VARCHAR'=357 'USER'=357
'WHEN'=358 'USING'=358
'WHERE'=359 'VALUE'=359
'WINDOW'=360 'VALUES'=360
'WITH'=361 'VARBINARY'=361
'WITHIN'=362 'VARCHAR'=362
'WITHOUT'=363 'WHEN'=363
'YEAR'=364 'WHERE'=364
'='=365 'WINDOW'=365
'>'=366 'WITH'=366
'<'=367 'WITHIN'=367
'!'=368 'WITHOUT'=368
'~'=369 'YEAR'=369
'|'=370 '='=370
'&'=371 '>'=371
'^'=372 '<'=372
'.'=373 '!'=373
'['=374 '~'=374
']'=375 '|'=375
'('=376 '&'=376
')'=377 '^'=377
'{'=378 '.'=378
'}'=379 '['=379
','=380 ']'=380
';'=381 '('=381
'@'=382 ')'=382
'\''=383 '{'=383
'"'=384 '}'=384
'`'=385 ','=385
':'=386 ';'=386
'*'=387 '@'=387
'_'=388 '\''=388
'-'=389 '"'=389
'+'=390 '`'=390
'%'=391 ':'=391
'||'=392 '*'=392
'--'=393 '_'=393
'/'=394 '-'=394
'?'=395 '+'=395
'=>'=396 '%'=396
'||'=397
'--'=398
'/'=399
'?'=400
'=>'=401

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
// Generated from /Users/zhenglin/Documents/parser/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.12.0 // Generated from /Users/hayden/Desktop/dt-works/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.12.0
import {ParseTreeListener} from "antlr4"; import {ParseTreeListener} from "antlr4";
@ -138,6 +138,7 @@ import { ExpressionContext } from "./FlinkSqlParser";
import { LogicalNotContext } from "./FlinkSqlParser"; import { LogicalNotContext } from "./FlinkSqlParser";
import { PredicatedContext } from "./FlinkSqlParser"; import { PredicatedContext } from "./FlinkSqlParser";
import { ExistsContext } from "./FlinkSqlParser"; import { ExistsContext } from "./FlinkSqlParser";
import { LogicalNestedContext } from "./FlinkSqlParser";
import { LogicalBinaryContext } from "./FlinkSqlParser"; import { LogicalBinaryContext } from "./FlinkSqlParser";
import { PredicateContext } from "./FlinkSqlParser"; import { PredicateContext } from "./FlinkSqlParser";
import { LikePredicateContext } from "./FlinkSqlParser"; import { LikePredicateContext } from "./FlinkSqlParser";
@ -201,6 +202,7 @@ import { StringLiteralContext } from "./FlinkSqlParser";
import { DecimalLiteralContext } from "./FlinkSqlParser"; import { DecimalLiteralContext } from "./FlinkSqlParser";
import { BooleanLiteralContext } from "./FlinkSqlParser"; import { BooleanLiteralContext } from "./FlinkSqlParser";
import { SetQuantifierContext } from "./FlinkSqlParser"; import { SetQuantifierContext } from "./FlinkSqlParser";
import { ReservedKeywordsUsedAsFunctionNameContext } from "./FlinkSqlParser";
import { ReservedKeywordsContext } from "./FlinkSqlParser"; import { ReservedKeywordsContext } from "./FlinkSqlParser";
import { NonReservedKeywordsContext } from "./FlinkSqlParser"; import { NonReservedKeywordsContext } from "./FlinkSqlParser";
@ -1570,6 +1572,18 @@ export default class FlinkSqlParserListener extends ParseTreeListener {
* @param ctx the parse tree * @param ctx the parse tree
*/ */
exitExists?: (ctx: ExistsContext) => void; exitExists?: (ctx: ExistsContext) => void;
/**
* Enter a parse tree produced by the `logicalNested`
* labeled alternative in `FlinkSqlParser.booleanExpression`.
* @param ctx the parse tree
*/
enterLogicalNested?: (ctx: LogicalNestedContext) => void;
/**
* Exit a parse tree produced by the `logicalNested`
* labeled alternative in `FlinkSqlParser.booleanExpression`.
* @param ctx the parse tree
*/
exitLogicalNested?: (ctx: LogicalNestedContext) => void;
/** /**
* Enter a parse tree produced by the `logicalBinary` * Enter a parse tree produced by the `logicalBinary`
* labeled alternative in `FlinkSqlParser.booleanExpression`. * labeled alternative in `FlinkSqlParser.booleanExpression`.
@ -2248,6 +2262,16 @@ export default class FlinkSqlParserListener extends ParseTreeListener {
* @param ctx the parse tree * @param ctx the parse tree
*/ */
exitSetQuantifier?: (ctx: SetQuantifierContext) => void; exitSetQuantifier?: (ctx: SetQuantifierContext) => void;
/**
* Enter a parse tree produced by `FlinkSqlParser.reservedKeywordsUsedAsFunctionName`.
* @param ctx the parse tree
*/
enterReservedKeywordsUsedAsFunctionName?: (ctx: ReservedKeywordsUsedAsFunctionNameContext) => void;
/**
* Exit a parse tree produced by `FlinkSqlParser.reservedKeywordsUsedAsFunctionName`.
* @param ctx the parse tree
*/
exitReservedKeywordsUsedAsFunctionName?: (ctx: ReservedKeywordsUsedAsFunctionNameContext) => void;
/** /**
* Enter a parse tree produced by `FlinkSqlParser.reservedKeywords`. * Enter a parse tree produced by `FlinkSqlParser.reservedKeywords`.
* @param ctx the parse tree * @param ctx the parse tree

View File

@ -1,4 +1,4 @@
// Generated from /Users/zhenglin/Documents/parser/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.12.0 // Generated from /Users/hayden/Desktop/dt-works/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.12.0
import {ParseTreeVisitor} from 'antlr4'; import {ParseTreeVisitor} from 'antlr4';
@ -138,6 +138,7 @@ import { ExpressionContext } from "./FlinkSqlParser";
import { LogicalNotContext } from "./FlinkSqlParser"; import { LogicalNotContext } from "./FlinkSqlParser";
import { PredicatedContext } from "./FlinkSqlParser"; import { PredicatedContext } from "./FlinkSqlParser";
import { ExistsContext } from "./FlinkSqlParser"; import { ExistsContext } from "./FlinkSqlParser";
import { LogicalNestedContext } from "./FlinkSqlParser";
import { LogicalBinaryContext } from "./FlinkSqlParser"; import { LogicalBinaryContext } from "./FlinkSqlParser";
import { PredicateContext } from "./FlinkSqlParser"; import { PredicateContext } from "./FlinkSqlParser";
import { LikePredicateContext } from "./FlinkSqlParser"; import { LikePredicateContext } from "./FlinkSqlParser";
@ -201,6 +202,7 @@ import { StringLiteralContext } from "./FlinkSqlParser";
import { DecimalLiteralContext } from "./FlinkSqlParser"; import { DecimalLiteralContext } from "./FlinkSqlParser";
import { BooleanLiteralContext } from "./FlinkSqlParser"; import { BooleanLiteralContext } from "./FlinkSqlParser";
import { SetQuantifierContext } from "./FlinkSqlParser"; import { SetQuantifierContext } from "./FlinkSqlParser";
import { ReservedKeywordsUsedAsFunctionNameContext } from "./FlinkSqlParser";
import { ReservedKeywordsContext } from "./FlinkSqlParser"; import { ReservedKeywordsContext } from "./FlinkSqlParser";
import { NonReservedKeywordsContext } from "./FlinkSqlParser"; import { NonReservedKeywordsContext } from "./FlinkSqlParser";
@ -1028,6 +1030,13 @@ export default class FlinkSqlParserVisitor<Result> extends ParseTreeVisitor<Resu
* @return the visitor result * @return the visitor result
*/ */
visitExists?: (ctx: ExistsContext) => Result; visitExists?: (ctx: ExistsContext) => Result;
/**
* Visit a parse tree produced by the `logicalNested`
* labeled alternative in `FlinkSqlParser.booleanExpression`.
* @param ctx the parse tree
* @return the visitor result
*/
visitLogicalNested?: (ctx: LogicalNestedContext) => Result;
/** /**
* Visit a parse tree produced by the `logicalBinary` * Visit a parse tree produced by the `logicalBinary`
* labeled alternative in `FlinkSqlParser.booleanExpression`. * labeled alternative in `FlinkSqlParser.booleanExpression`.
@ -1430,6 +1439,12 @@ export default class FlinkSqlParserVisitor<Result> extends ParseTreeVisitor<Resu
* @return the visitor result * @return the visitor result
*/ */
visitSetQuantifier?: (ctx: SetQuantifierContext) => Result; visitSetQuantifier?: (ctx: SetQuantifierContext) => Result;
/**
* Visit a parse tree produced by `FlinkSqlParser.reservedKeywordsUsedAsFunctionName`.
* @param ctx the parse tree
* @return the visitor result
*/
visitReservedKeywordsUsedAsFunctionName?: (ctx: ReservedKeywordsUsedAsFunctionNameContext) => Result;
/** /**
* Visit a parse tree produced by `FlinkSqlParser.reservedKeywords`. * Visit a parse tree produced by `FlinkSqlParser.reservedKeywords`.
* @param ctx the parse tree * @param ctx the parse tree

View File

@ -0,0 +1,27 @@
SELECT id, age FROM table1 WHERE age IS NOT NULL;
SELECT id, age FROM table1 WHERE age IS NOT DISTINCT FROM 12;
SELECT id, age FROM table1 WHERE age BETWEEN SYMMETRIC 25 AND 18;
SELECT id, age FROM table1 WHERE age NOT LIKE "%aa_d%" ESCAPE "a";
SELECT addr FROM table1 WHERE addr NOT SIMILAR TO '%(123|yz)%' ESCAPE "y";
SELECT id, age FROM table1 WHERE age NOT IN (18,19,20);
SELECT id FROM table1 WHERE id NOT IN ( SELECT * FROM table2 );
SELECT S,SNAME
FROM S
WHERE NOT EXISTS
(SELECT *
FROM C
WHERE NOT EXISTS
(SELECT *
FROM SC
WHERE SC.S=S.S AND SC.C=C.C));
SELECT id, age FROM table1 WHERE age > 18 OR id = 1;
SELECT id, age FROM table1 WHERE age > 18 AND id > 10;

View File

@ -11,7 +11,8 @@ const features = {
aggregation: readSQL(__dirname, "selectAggregation.sql"), aggregation: readSQL(__dirname, "selectAggregation.sql"),
join: readSQL(__dirname, "selectJoin.sql"), join: readSQL(__dirname, "selectJoin.sql"),
setOperation: readSQL(__dirname, "selectSetOperations.sql"), setOperation: readSQL(__dirname, "selectSetOperations.sql"),
pattern: readSQL(__dirname, "selectPatternRecognition.sql") pattern: readSQL(__dirname, "selectPatternRecognition.sql"),
where: readSQL(__dirname, "selectWhere.sql"),
}; };
describe("FlinkSQL Query Statement Tests", () => { describe("FlinkSQL Query Statement Tests", () => {
@ -79,4 +80,12 @@ describe("FlinkSQL Query Statement Tests", () => {
}); });
}) })
}) })
describe("Select Where", () => {
features.where.forEach((sql) => {
it(sql, () => {
expect(parser.validate(sql).length).toBe(0)
})
})
})
}); });