feat(flink): modify grammar to match keywords

This commit is contained in:
Erindcl 2020-12-08 16:04:56 +08:00
parent cc1d5abcdd
commit e67f991ede
11 changed files with 7148 additions and 4976 deletions

View File

@ -127,25 +127,8 @@ TRAILING: 'TRAILING';
IF: 'IF';
POSITION: 'POSITION';
EXTRACT: 'EXTRACT';
EQ: 'EQ';
NSEQ: 'NSEQ';
NEQ: 'NEQ';
NEQJ: 'NEQJ';
LT: 'LT';
LTE: 'LTE';
GT: 'GT';
GTE: 'GTE';
PLUS: 'PLUS';
MINUS: 'MINUS';
ASTERISK: 'ASTERISK';
SLASH: 'SLASH';
PERCENT: 'PERCENT';
DIV: 'DIV';
TILDE: 'TILDE';
AMPERSAND: 'AMPERSAND';
PIPE: 'PIPE';
CONCAT_PIPE: 'CONCAT_PIPE';
HAT: 'HAT';
PERCENTLIT: 'PERCENTLIT';
BUCKET: 'BUCKET';
OUT: 'OUT';
@ -240,23 +223,14 @@ LOCAL: 'LOCAL';
INPATH: 'INPATH';
WATERMARK: 'WATERMARK';
UNNEST: 'UNNEST';
MATCH_RECOGNIZE: 'MATCH_RECOGNIZE';
MEASURES: 'MEASURES';
ONE: 'ONE';
PER: 'PER';
MATCH: 'MATCH';
SKIP1: 'SKIP1';
NEXT: 'NEXT';
PAST: 'PAST';
PATTERN: 'PATTERN';
WITHIN: 'WITHIN';
DEFINE: 'DEFINE';
WS: 'WS';
SYSTEM: 'SYSTEM';
INCLUDING: 'INCLUDING';
EXCLUDING: 'EXCLUDING';
CONSTRAINTS: 'CONSTRAINTS';
OVERWRITING: 'OVERWRITING';
GENERATED: 'GENERATED';
CATALOG: 'CATALOG';
LANGUAGE: 'LANGUAGE';

View File

@ -463,11 +463,14 @@ identifierSeq
identifier
: strictIdentifier
| strictNonReserved
;
strictIdentifier
: unquotedIdentifier #unquotedIdentifierAlternative
| quotedIdentifier #quotedIdentifierAlternative
| ansiNonReserved #ansiNonReservedKeywords
| nonReserved #nonReservedKeywords
;
unquotedIdentifier
@ -574,3 +577,468 @@ setQuantifier
: DISTINCT
| ALL
;
ansiNonReserved
: ADD
| AFTER
| ALTER
| ANALYZE
| ANTI
| ARCHIVE
| ARRAY
| ASC
| AT
| BETWEEN
| BIGINT
| BINARY
| BOOLEAN
| BUCKET
| BUCKETS
| BY
| BYTES
| CACHE
| CASCADE
| CATALOG
| CATALOGS
| CHANGE
| CHAR
| CLEAR
| CLUSTER
| CLUSTERED
| CODEGEN
| COLLECTION
| COLUMNS
| COMMENT
| COMMIT
| COMPACT
| COMPACTIONS
| COMPUTE
| CONCATENATE
| CONSTRAINTS
| COST
| CUBE
| CURRENT
| DATA
| DATABASE
| DATABASES
| DATE
| DATETIME
| DBPROPERTIES
| DECIMAL
| DEFINED
| DELETE
| DELIMITED
| DESC
| DESCRIBE
| DFS
| DIRECTORIES
| DIRECTORY
| DISTRIBUTE
| DIV
| DOUBLE
| DROP
| ESCAPED
| EXCHANGE
| EXCLUDING
| EXISTS
| EXPLAIN
| EXPORT
| EXTENDED
| EXTERNAL
| EXTRACT
| FIELDS
| FILEFORMAT
| FIRST
| FLOAT
| FOLLOWING
| FORMAT
| FORMATTED
| FUNCTION
| FUNCTIONS
| GENERATED
| GLOBAL
| GROUPING
| IF
| IGNORE
| IMPORT
| INCLUDING
| INDEX
| INDEXES
| INPATH
| INPUTFORMAT
| INSERT
| INT
| INTERVAL
| ITEMS
| KEY
| KEYS
| LANGUAGE
| LAST
| LATERAL
| LAZY
| LIKE
| LIMIT
| LINES
| LIST
| LOAD
| LOCAL
| LOCATION
| LOCK
| LOCKS
| LOGICAL
| MACRO
| MAP
| MATCH
| MINUS
| MSCK
| MULTISET
| NEXT
| NO
| NULL
| NULLS
| OF
| OPTION
| OPTIONS
| OUT
| OUTPUTFORMAT
| OVER
| OVERWRITE
| PARTITION
| PARTITIONED
| PARTITIONS
| PERCENTLIT
| PERIOD
| PIVOT
| POSITION
| PRECEDING
| PRINCIPALS
| PURGE
| RANGE
| RAW
| RECORDREADER
| RECORDWRITER
| RECOVER
| REDUCE
| REFRESH
| RENAME
| REPAIR
| REPLACE
| RESET
| RESTRICT
| REVOKE
| RLIKE
| ROLE
| ROLES
| ROLLBACK
| ROLLUP
| ROW
| ROWS
| SEMI
| SEPARATED
| SERDE
| SERDEPROPERTIES
| SET
| SETMINUS
| SETS
| SHOW
| SKEWED
| SMALLINT
| SORT
| SORTED
| START
| STATISTICS
| STORED
| STRATIFY
| STRING
| STRUCT
| SYSTEM
| SYSTEM_TIME
| TABLES
| TABLESAMPLE
| TBLPROPERTIES
| TEMPORARY
| TERMINATED
| TIME
| TIMESTAMP
| TINYINT
| TOUCH
| TRANSACTION
| TRANSACTIONS
| TRANSFORM
| TRUE
| TRUNCATE
| UNARCHIVE
| UNBOUNDED
| UNCACHE
| UNLOCK
| UNSET
| UNNEST
| USE
| VALUES
| VARBINARY
| VARCHAR
| VIEW
| VIEWS
| WATERMARK
| WINDOW
| WITHIN
| WS
;
strictNonReserved
: ANTI
| CROSS
| EXCEPT
| FULL
| INNER
| INTERSECT
| JOIN
| LEFT
| NATURAL
| ON
| RIGHT
| SEMI
| SETMINUS
| UNION
| USING
;
nonReserved
: ADD
| AFTER
| ALL
| ALTER
| ANALYZE
| AND
| ANY
| COLUMNS
| ARRAY
| AS
| ASC
| AT
| BETWEEN
| BIGINT
| BINARY
| BOOLEAN
| BOTH
| BUCKET
| BUCKETS
| BY
| BYTES
| CACHE
| CASCADE
| CASE
| CAST
| CATALOG
| CATALOGS
| CHANGE
| CHAR
| CLEAR
| CLUSTER
| CLUSTERED
| CODEGEN
| COLLECTION
| COLUMN
| COLUMNS
| COMMENT
| COMMIT
| COMPACT
| COMPACTIONS
| COMPUTE
| CONCATENATE
| CONSTRAINT
| CONSTRAINTS
| COST
| CREATE
| CUBE
| CURRENT
| DATA
| DATABASE
| DATABASES
| DATE
| DATETIME
| DBPROPERTIES
| DECIMAL
| DEFINED
| DELETE
| DELIMITED
| DESC
| DESCRIBE
| DFS
| DIRECTORIES
| DIRECTORY
| DISTINCT
| DISTRIBUTE
| DIV
| DOUBLE
| DROP
| ELSE
| END
| ESCAPED
| EXCHANGE
| EXCLUDING
| EXISTS
| EXPLAIN
| EXPORT
| EXTENDED
| EXTERNAL
| EXTRACT
| FALSE
| FIELDS
| FILEFORMAT
| FIRST
| FLOAT
| FOLLOWING
| FOR
| FORMAT
| FORMATTED
| FROM
| FUNCTION
| FUNCTIONS
| GENERATED
| GLOBAL
| GRANT
| GROUP
| GROUPING
| HAVING
| IF
| IGNORE
| IMPORT
| IN
| INCLUDING
| INDEX
| INDEXES
| INPATH
| INPUTFORMAT
| INSERT
| INT
| INTERVAL
| INTO
| IS
| ITEMS
| KEY
| KEYS
| LANGUAGE
| LAST
| LATERAL
| LAZY
| LEADING
| LIKE
| LIMIT
| LINES
| LIST
| LOAD
| LOCAL
| LOCATION
| LOCK
| LOCKS
| LOGICAL
| MACRO
| MAP
| MATCH
| MINUS
| MSCK
| MULTISET
| NEXT
| NO
| NOT
| NULL
| NULLS
| OF
| OPTION
| OPTIONS
| OR
| ORDER
| OUT
| OUTER
| OUTPUTFORMAT
| OVER
| OVERWRITE
| PARTITION
| PARTITIONED
| PARTITIONS
| PERCENTLIT
| PERIOD
| PIVOT
| POSITION
| PRECEDING
| PRIMARY
| PRINCIPALS
| PURGE
| RANGE
| RAW
| RECORDREADER
| RECORDWRITER
| RECOVER
| REDUCE
| REFRESH
| RENAME
| REPAIR
| REPLACE
| RESET
| RESTRICT
| REVOKE
| RLIKE
| ROLE
| ROLES
| ROLLBACK
| ROLLUP
| ROW
| ROWS
| SELECT
| SEPARATED
| SERDE
| SERDEPROPERTIES
| SET
| SETS
| SHOW
| SKEWED
| SMALLINT
| SORT
| SORTED
| START
| STATISTICS
| STORED
| STRATIFY
| STRING
| STRUCT
| SYSTEM
| SYSTEM_TIME
| TABLE
| TABLES
| TABLESAMPLE
| TBLPROPERTIES
| TEMPORARY
| TERMINATED
| THEN
| TIME
| TIMESTAMP
| TINYINT
| TO
| TOUCH
| TRAILING
| TRANSACTION
| TRANSACTIONS
| TRANSFORM
| TRUE
| TRUNCATE
| UNARCHIVE
| UNBOUNDED
| UNCACHE
| UNLOCK
| UNSET
| UNNEST
| USE
| VALUES
| VARBINARY
| VARCHAR
| VIEW
| VIEWS
| WATERMARK
| WHEN
| WHERE
| WINDOW
| WITH
| WITHIN
| WS
;

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -116,205 +116,179 @@ TRAILING=115
IF=116
POSITION=117
EXTRACT=118
EQ=119
NSEQ=120
NEQ=121
NEQJ=122
LT=123
LTE=124
GT=125
GTE=126
PLUS=127
MINUS=128
ASTERISK=129
SLASH=130
PERCENT=131
DIV=132
TILDE=133
AMPERSAND=134
PIPE=135
CONCAT_PIPE=136
HAT=137
PERCENTLIT=138
BUCKET=139
OUT=140
OF=141
SORT=142
CLUSTER=143
DISTRIBUTE=144
OVERWRITE=145
TRANSFORM=146
REDUCE=147
USING=148
SERDE=149
SERDEPROPERTIES=150
RECORDREADER=151
RECORDWRITER=152
DELIMITED=153
FIELDS=154
TERMINATED=155
COLLECTION=156
ITEMS=157
KEYS=158
ESCAPED=159
LINES=160
SEPARATED=161
FUNCTION=162
EXTENDED=163
REFRESH=164
CLEAR=165
CACHE=166
UNCACHE=167
LAZY=168
FORMATTED=169
GLOBAL=170
TEMPORARY=171
OPTIONS=172
UNSET=173
TBLPROPERTIES=174
DBPROPERTIES=175
BUCKETS=176
SKEWED=177
STORED=178
DIRECTORIES=179
LOCATION=180
EXCHANGE=181
ARCHIVE=182
UNARCHIVE=183
FILEFORMAT=184
TOUCH=185
COMPACT=186
CONCATENATE=187
CHANGE=188
CASCADE=189
CONSTRAINT=190
RESTRICT=191
CLUSTERED=192
SORTED=193
PURGE=194
INPUTFORMAT=195
OUTPUTFORMAT=196
DATABASE=197
DATABASES=198
DFS=199
TRUNCATE=200
ANALYZE=201
COMPUTE=202
LIST=203
STATISTICS=204
PARTITIONED=205
EXTERNAL=206
DEFINED=207
REVOKE=208
GRANT=209
LOCK=210
UNLOCK=211
MSCK=212
REPAIR=213
RECOVER=214
EXPORT=215
IMPORT=216
LOAD=217
ROLE=218
ROLES=219
COMPACTIONS=220
PRINCIPALS=221
TRANSACTIONS=222
INDEX=223
INDEXES=224
LOCKS=225
OPTION=226
ANTI=227
LOCAL=228
INPATH=229
WATERMARK=230
UNNEST=231
MATCH_RECOGNIZE=232
MEASURES=233
ONE=234
PER=235
MATCH=236
SKIP1=237
NEXT=238
PAST=239
PATTERN=240
WITHIN=241
DEFINE=242
WS=243
SYSTEM=244
INCLUDING=245
EXCLUDING=246
CONSTRAINTS=247
OVERWRITING=248
GENERATED=249
CATALOG=250
LANGUAGE=251
CATALOGS=252
VIEWS=253
PRIMARY=254
KEY=255
PERIOD=256
SYSTEM_TIME=257
STRING=258
ARRAY=259
MAP=260
CHAR=261
VARCHAR=262
BINARY=263
VARBINARY=264
BYTES=265
DECIMAL=266
TINYINT=267
SMALLINT=268
INT=269
BIGINT=270
FLOAT=271
DOUBLE=272
DATE=273
TIME=274
TIMESTAMP=275
MULTISET=276
BOOLEAN=277
RAW=278
ROW=279
NULL=280
DATETIME=281
EQUAL_SYMBOL=282
GREATER_SYMBOL=283
LESS_SYMBOL=284
EXCLAMATION_SYMBOL=285
BIT_NOT_OP=286
BIT_OR_OP=287
BIT_AND_OP=288
BIT_XOR_OP=289
DOT=290
LS_BRACKET=291
RS_BRACKET=292
LR_BRACKET=293
RR_BRACKET=294
COMMA=295
SEMICOLON=296
AT_SIGN=297
SINGLE_QUOTE_SYMB=298
DOUBLE_QUOTE_SYMB=299
REVERSE_QUOTE_SYMB=300
COLON_SYMB=301
ASTERISK_SIGN=302
UNDERLINE_SIGN=303
HYPNEN_SIGN=304
ADD_SIGN=305
PENCENT_SIGN=306
DOUBLE_VERTICAL_SIGN=307
DOUBLE_HYPNEN_SIGN=308
SLASH_SIGN=309
DOT_ID=310
PLUS_DOT_ID=311
STRING_LITERAL=312
DIG_LITERAL=313
REAL_LITERAL=314
BIT_STRING=315
ID_LITERAL=316
PLUS_ID_LITERAL=317
MINUS=119
DIV=120
PERCENTLIT=121
BUCKET=122
OUT=123
OF=124
SORT=125
CLUSTER=126
DISTRIBUTE=127
OVERWRITE=128
TRANSFORM=129
REDUCE=130
USING=131
SERDE=132
SERDEPROPERTIES=133
RECORDREADER=134
RECORDWRITER=135
DELIMITED=136
FIELDS=137
TERMINATED=138
COLLECTION=139
ITEMS=140
KEYS=141
ESCAPED=142
LINES=143
SEPARATED=144
FUNCTION=145
EXTENDED=146
REFRESH=147
CLEAR=148
CACHE=149
UNCACHE=150
LAZY=151
FORMATTED=152
GLOBAL=153
TEMPORARY=154
OPTIONS=155
UNSET=156
TBLPROPERTIES=157
DBPROPERTIES=158
BUCKETS=159
SKEWED=160
STORED=161
DIRECTORIES=162
LOCATION=163
EXCHANGE=164
ARCHIVE=165
UNARCHIVE=166
FILEFORMAT=167
TOUCH=168
COMPACT=169
CONCATENATE=170
CHANGE=171
CASCADE=172
CONSTRAINT=173
RESTRICT=174
CLUSTERED=175
SORTED=176
PURGE=177
INPUTFORMAT=178
OUTPUTFORMAT=179
DATABASE=180
DATABASES=181
DFS=182
TRUNCATE=183
ANALYZE=184
COMPUTE=185
LIST=186
STATISTICS=187
PARTITIONED=188
EXTERNAL=189
DEFINED=190
REVOKE=191
GRANT=192
LOCK=193
UNLOCK=194
MSCK=195
REPAIR=196
RECOVER=197
EXPORT=198
IMPORT=199
LOAD=200
ROLE=201
ROLES=202
COMPACTIONS=203
PRINCIPALS=204
TRANSACTIONS=205
INDEX=206
INDEXES=207
LOCKS=208
OPTION=209
ANTI=210
LOCAL=211
INPATH=212
WATERMARK=213
UNNEST=214
MATCH=215
NEXT=216
WITHIN=217
WS=218
SYSTEM=219
INCLUDING=220
EXCLUDING=221
CONSTRAINTS=222
GENERATED=223
CATALOG=224
LANGUAGE=225
CATALOGS=226
VIEWS=227
PRIMARY=228
KEY=229
PERIOD=230
SYSTEM_TIME=231
STRING=232
ARRAY=233
MAP=234
CHAR=235
VARCHAR=236
BINARY=237
VARBINARY=238
BYTES=239
DECIMAL=240
TINYINT=241
SMALLINT=242
INT=243
BIGINT=244
FLOAT=245
DOUBLE=246
DATE=247
TIME=248
TIMESTAMP=249
MULTISET=250
BOOLEAN=251
RAW=252
ROW=253
NULL=254
DATETIME=255
EQUAL_SYMBOL=256
GREATER_SYMBOL=257
LESS_SYMBOL=258
EXCLAMATION_SYMBOL=259
BIT_NOT_OP=260
BIT_OR_OP=261
BIT_AND_OP=262
BIT_XOR_OP=263
DOT=264
LS_BRACKET=265
RS_BRACKET=266
LR_BRACKET=267
RR_BRACKET=268
COMMA=269
SEMICOLON=270
AT_SIGN=271
SINGLE_QUOTE_SYMB=272
DOUBLE_QUOTE_SYMB=273
REVERSE_QUOTE_SYMB=274
COLON_SYMB=275
ASTERISK_SIGN=276
UNDERLINE_SIGN=277
HYPNEN_SIGN=278
ADD_SIGN=279
PENCENT_SIGN=280
DOUBLE_VERTICAL_SIGN=281
DOUBLE_HYPNEN_SIGN=282
SLASH_SIGN=283
DOT_ID=284
PLUS_DOT_ID=285
STRING_LITERAL=286
DIG_LITERAL=287
REAL_LITERAL=288
BIT_STRING=289
ID_LITERAL=290
PLUS_ID_LITERAL=291
'SELECT'=4
'FROM'=5
'ADD'=6
@ -430,194 +404,168 @@ PLUS_ID_LITERAL=317
'IF'=116
'POSITION'=117
'EXTRACT'=118
'EQ'=119
'NSEQ'=120
'NEQ'=121
'NEQJ'=122
'LT'=123
'LTE'=124
'GT'=125
'GTE'=126
'PLUS'=127
'MINUS'=128
'ASTERISK'=129
'SLASH'=130
'PERCENT'=131
'DIV'=132
'TILDE'=133
'AMPERSAND'=134
'PIPE'=135
'CONCAT_PIPE'=136
'HAT'=137
'PERCENTLIT'=138
'BUCKET'=139
'OUT'=140
'OF'=141
'SORT'=142
'CLUSTER'=143
'DISTRIBUTE'=144
'OVERWRITE'=145
'TRANSFORM'=146
'REDUCE'=147
'USING'=148
'SERDE'=149
'SERDEPROPERTIES'=150
'RECORDREADER'=151
'RECORDWRITER'=152
'DELIMITED'=153
'FIELDS'=154
'TERMINATED'=155
'COLLECTION'=156
'ITEMS'=157
'KEYS'=158
'ESCAPED'=159
'LINES'=160
'SEPARATED'=161
'FUNCTION'=162
'EXTENDED'=163
'REFRESH'=164
'CLEAR'=165
'CACHE'=166
'UNCACHE'=167
'LAZY'=168
'FORMATTED'=169
'GLOBAL'=170
'TEMPORARY'=171
'OPTIONS'=172
'UNSET'=173
'TBLPROPERTIES'=174
'DBPROPERTIES'=175
'BUCKETS'=176
'SKEWED'=177
'STORED'=178
'DIRECTORIES'=179
'LOCATION'=180
'EXCHANGE'=181
'ARCHIVE'=182
'UNARCHIVE'=183
'FILEFORMAT'=184
'TOUCH'=185
'COMPACT'=186
'CONCATENATE'=187
'CHANGE'=188
'CASCADE'=189
'CONSTRAINT'=190
'RESTRICT'=191
'CLUSTERED'=192
'SORTED'=193
'PURGE'=194
'INPUTFORMAT'=195
'OUTPUTFORMAT'=196
'DATABASE'=197
'DATABASES'=198
'DFS'=199
'TRUNCATE'=200
'ANALYZE'=201
'COMPUTE'=202
'LIST'=203
'STATISTICS'=204
'PARTITIONED'=205
'EXTERNAL'=206
'DEFINED'=207
'REVOKE'=208
'GRANT'=209
'LOCK'=210
'UNLOCK'=211
'MSCK'=212
'REPAIR'=213
'RECOVER'=214
'EXPORT'=215
'IMPORT'=216
'LOAD'=217
'ROLE'=218
'ROLES'=219
'COMPACTIONS'=220
'PRINCIPALS'=221
'TRANSACTIONS'=222
'INDEX'=223
'INDEXES'=224
'LOCKS'=225
'OPTION'=226
'ANTI'=227
'LOCAL'=228
'INPATH'=229
'WATERMARK'=230
'UNNEST'=231
'MATCH_RECOGNIZE'=232
'MEASURES'=233
'ONE'=234
'PER'=235
'MATCH'=236
'SKIP1'=237
'NEXT'=238
'PAST'=239
'PATTERN'=240
'WITHIN'=241
'DEFINE'=242
'WS'=243
'SYSTEM'=244
'INCLUDING'=245
'EXCLUDING'=246
'CONSTRAINTS'=247
'OVERWRITING'=248
'GENERATED'=249
'CATALOG'=250
'LANGUAGE'=251
'CATALOGS'=252
'VIEWS'=253
'PRIMARY'=254
'KEY'=255
'PERIOD'=256
'SYSTEM_TIME'=257
'STRING'=258
'ARRAY'=259
'MAP'=260
'CHAR'=261
'VARCHAR'=262
'BINARY'=263
'VARBINARY'=264
'BYTES'=265
'DECIMAL'=266
'TINYINT'=267
'SMALLINT'=268
'INT'=269
'BIGINT'=270
'FLOAT'=271
'DOUBLE'=272
'DATE'=273
'TIME'=274
'TIMESTAMP'=275
'MULTISET'=276
'BOOLEAN'=277
'RAW'=278
'ROW'=279
'NULL'=280
'DATETIME'=281
'='=282
'>'=283
'<'=284
'!'=285
'~'=286
'|'=287
'&'=288
'^'=289
'.'=290
'['=291
']'=292
'('=293
')'=294
','=295
';'=296
'@'=297
'\''=298
'"'=299
'`'=300
':'=301
'*'=302
'_'=303
'-'=304
'+'=305
'%'=306
'||'=307
'--'=308
'/'=309
'MINUS'=119
'DIV'=120
'PERCENTLIT'=121
'BUCKET'=122
'OUT'=123
'OF'=124
'SORT'=125
'CLUSTER'=126
'DISTRIBUTE'=127
'OVERWRITE'=128
'TRANSFORM'=129
'REDUCE'=130
'USING'=131
'SERDE'=132
'SERDEPROPERTIES'=133
'RECORDREADER'=134
'RECORDWRITER'=135
'DELIMITED'=136
'FIELDS'=137
'TERMINATED'=138
'COLLECTION'=139
'ITEMS'=140
'KEYS'=141
'ESCAPED'=142
'LINES'=143
'SEPARATED'=144
'FUNCTION'=145
'EXTENDED'=146
'REFRESH'=147
'CLEAR'=148
'CACHE'=149
'UNCACHE'=150
'LAZY'=151
'FORMATTED'=152
'GLOBAL'=153
'TEMPORARY'=154
'OPTIONS'=155
'UNSET'=156
'TBLPROPERTIES'=157
'DBPROPERTIES'=158
'BUCKETS'=159
'SKEWED'=160
'STORED'=161
'DIRECTORIES'=162
'LOCATION'=163
'EXCHANGE'=164
'ARCHIVE'=165
'UNARCHIVE'=166
'FILEFORMAT'=167
'TOUCH'=168
'COMPACT'=169
'CONCATENATE'=170
'CHANGE'=171
'CASCADE'=172
'CONSTRAINT'=173
'RESTRICT'=174
'CLUSTERED'=175
'SORTED'=176
'PURGE'=177
'INPUTFORMAT'=178
'OUTPUTFORMAT'=179
'DATABASE'=180
'DATABASES'=181
'DFS'=182
'TRUNCATE'=183
'ANALYZE'=184
'COMPUTE'=185
'LIST'=186
'STATISTICS'=187
'PARTITIONED'=188
'EXTERNAL'=189
'DEFINED'=190
'REVOKE'=191
'GRANT'=192
'LOCK'=193
'UNLOCK'=194
'MSCK'=195
'REPAIR'=196
'RECOVER'=197
'EXPORT'=198
'IMPORT'=199
'LOAD'=200
'ROLE'=201
'ROLES'=202
'COMPACTIONS'=203
'PRINCIPALS'=204
'TRANSACTIONS'=205
'INDEX'=206
'INDEXES'=207
'LOCKS'=208
'OPTION'=209
'ANTI'=210
'LOCAL'=211
'INPATH'=212
'WATERMARK'=213
'UNNEST'=214
'MATCH'=215
'NEXT'=216
'WITHIN'=217
'WS'=218
'SYSTEM'=219
'INCLUDING'=220
'EXCLUDING'=221
'CONSTRAINTS'=222
'GENERATED'=223
'CATALOG'=224
'LANGUAGE'=225
'CATALOGS'=226
'VIEWS'=227
'PRIMARY'=228
'KEY'=229
'PERIOD'=230
'SYSTEM_TIME'=231
'STRING'=232
'ARRAY'=233
'MAP'=234
'CHAR'=235
'VARCHAR'=236
'BINARY'=237
'VARBINARY'=238
'BYTES'=239
'DECIMAL'=240
'TINYINT'=241
'SMALLINT'=242
'INT'=243
'BIGINT'=244
'FLOAT'=245
'DOUBLE'=246
'DATE'=247
'TIME'=248
'TIMESTAMP'=249
'MULTISET'=250
'BOOLEAN'=251
'RAW'=252
'ROW'=253
'NULL'=254
'DATETIME'=255
'='=256
'>'=257
'<'=258
'!'=259
'~'=260
'|'=261
'&'=262
'^'=263
'.'=264
'['=265
']'=266
'('=267
')'=268
','=269
';'=270
'@'=271
'\''=272
'"'=273
'`'=274
':'=275
'*'=276
'_'=277
'-'=278
'+'=279
'%'=280
'||'=281
'--'=282
'/'=283

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -116,205 +116,179 @@ TRAILING=115
IF=116
POSITION=117
EXTRACT=118
EQ=119
NSEQ=120
NEQ=121
NEQJ=122
LT=123
LTE=124
GT=125
GTE=126
PLUS=127
MINUS=128
ASTERISK=129
SLASH=130
PERCENT=131
DIV=132
TILDE=133
AMPERSAND=134
PIPE=135
CONCAT_PIPE=136
HAT=137
PERCENTLIT=138
BUCKET=139
OUT=140
OF=141
SORT=142
CLUSTER=143
DISTRIBUTE=144
OVERWRITE=145
TRANSFORM=146
REDUCE=147
USING=148
SERDE=149
SERDEPROPERTIES=150
RECORDREADER=151
RECORDWRITER=152
DELIMITED=153
FIELDS=154
TERMINATED=155
COLLECTION=156
ITEMS=157
KEYS=158
ESCAPED=159
LINES=160
SEPARATED=161
FUNCTION=162
EXTENDED=163
REFRESH=164
CLEAR=165
CACHE=166
UNCACHE=167
LAZY=168
FORMATTED=169
GLOBAL=170
TEMPORARY=171
OPTIONS=172
UNSET=173
TBLPROPERTIES=174
DBPROPERTIES=175
BUCKETS=176
SKEWED=177
STORED=178
DIRECTORIES=179
LOCATION=180
EXCHANGE=181
ARCHIVE=182
UNARCHIVE=183
FILEFORMAT=184
TOUCH=185
COMPACT=186
CONCATENATE=187
CHANGE=188
CASCADE=189
CONSTRAINT=190
RESTRICT=191
CLUSTERED=192
SORTED=193
PURGE=194
INPUTFORMAT=195
OUTPUTFORMAT=196
DATABASE=197
DATABASES=198
DFS=199
TRUNCATE=200
ANALYZE=201
COMPUTE=202
LIST=203
STATISTICS=204
PARTITIONED=205
EXTERNAL=206
DEFINED=207
REVOKE=208
GRANT=209
LOCK=210
UNLOCK=211
MSCK=212
REPAIR=213
RECOVER=214
EXPORT=215
IMPORT=216
LOAD=217
ROLE=218
ROLES=219
COMPACTIONS=220
PRINCIPALS=221
TRANSACTIONS=222
INDEX=223
INDEXES=224
LOCKS=225
OPTION=226
ANTI=227
LOCAL=228
INPATH=229
WATERMARK=230
UNNEST=231
MATCH_RECOGNIZE=232
MEASURES=233
ONE=234
PER=235
MATCH=236
SKIP1=237
NEXT=238
PAST=239
PATTERN=240
WITHIN=241
DEFINE=242
WS=243
SYSTEM=244
INCLUDING=245
EXCLUDING=246
CONSTRAINTS=247
OVERWRITING=248
GENERATED=249
CATALOG=250
LANGUAGE=251
CATALOGS=252
VIEWS=253
PRIMARY=254
KEY=255
PERIOD=256
SYSTEM_TIME=257
STRING=258
ARRAY=259
MAP=260
CHAR=261
VARCHAR=262
BINARY=263
VARBINARY=264
BYTES=265
DECIMAL=266
TINYINT=267
SMALLINT=268
INT=269
BIGINT=270
FLOAT=271
DOUBLE=272
DATE=273
TIME=274
TIMESTAMP=275
MULTISET=276
BOOLEAN=277
RAW=278
ROW=279
NULL=280
DATETIME=281
EQUAL_SYMBOL=282
GREATER_SYMBOL=283
LESS_SYMBOL=284
EXCLAMATION_SYMBOL=285
BIT_NOT_OP=286
BIT_OR_OP=287
BIT_AND_OP=288
BIT_XOR_OP=289
DOT=290
LS_BRACKET=291
RS_BRACKET=292
LR_BRACKET=293
RR_BRACKET=294
COMMA=295
SEMICOLON=296
AT_SIGN=297
SINGLE_QUOTE_SYMB=298
DOUBLE_QUOTE_SYMB=299
REVERSE_QUOTE_SYMB=300
COLON_SYMB=301
ASTERISK_SIGN=302
UNDERLINE_SIGN=303
HYPNEN_SIGN=304
ADD_SIGN=305
PENCENT_SIGN=306
DOUBLE_VERTICAL_SIGN=307
DOUBLE_HYPNEN_SIGN=308
SLASH_SIGN=309
DOT_ID=310
PLUS_DOT_ID=311
STRING_LITERAL=312
DIG_LITERAL=313
REAL_LITERAL=314
BIT_STRING=315
ID_LITERAL=316
PLUS_ID_LITERAL=317
MINUS=119
DIV=120
PERCENTLIT=121
BUCKET=122
OUT=123
OF=124
SORT=125
CLUSTER=126
DISTRIBUTE=127
OVERWRITE=128
TRANSFORM=129
REDUCE=130
USING=131
SERDE=132
SERDEPROPERTIES=133
RECORDREADER=134
RECORDWRITER=135
DELIMITED=136
FIELDS=137
TERMINATED=138
COLLECTION=139
ITEMS=140
KEYS=141
ESCAPED=142
LINES=143
SEPARATED=144
FUNCTION=145
EXTENDED=146
REFRESH=147
CLEAR=148
CACHE=149
UNCACHE=150
LAZY=151
FORMATTED=152
GLOBAL=153
TEMPORARY=154
OPTIONS=155
UNSET=156
TBLPROPERTIES=157
DBPROPERTIES=158
BUCKETS=159
SKEWED=160
STORED=161
DIRECTORIES=162
LOCATION=163
EXCHANGE=164
ARCHIVE=165
UNARCHIVE=166
FILEFORMAT=167
TOUCH=168
COMPACT=169
CONCATENATE=170
CHANGE=171
CASCADE=172
CONSTRAINT=173
RESTRICT=174
CLUSTERED=175
SORTED=176
PURGE=177
INPUTFORMAT=178
OUTPUTFORMAT=179
DATABASE=180
DATABASES=181
DFS=182
TRUNCATE=183
ANALYZE=184
COMPUTE=185
LIST=186
STATISTICS=187
PARTITIONED=188
EXTERNAL=189
DEFINED=190
REVOKE=191
GRANT=192
LOCK=193
UNLOCK=194
MSCK=195
REPAIR=196
RECOVER=197
EXPORT=198
IMPORT=199
LOAD=200
ROLE=201
ROLES=202
COMPACTIONS=203
PRINCIPALS=204
TRANSACTIONS=205
INDEX=206
INDEXES=207
LOCKS=208
OPTION=209
ANTI=210
LOCAL=211
INPATH=212
WATERMARK=213
UNNEST=214
MATCH=215
NEXT=216
WITHIN=217
WS=218
SYSTEM=219
INCLUDING=220
EXCLUDING=221
CONSTRAINTS=222
GENERATED=223
CATALOG=224
LANGUAGE=225
CATALOGS=226
VIEWS=227
PRIMARY=228
KEY=229
PERIOD=230
SYSTEM_TIME=231
STRING=232
ARRAY=233
MAP=234
CHAR=235
VARCHAR=236
BINARY=237
VARBINARY=238
BYTES=239
DECIMAL=240
TINYINT=241
SMALLINT=242
INT=243
BIGINT=244
FLOAT=245
DOUBLE=246
DATE=247
TIME=248
TIMESTAMP=249
MULTISET=250
BOOLEAN=251
RAW=252
ROW=253
NULL=254
DATETIME=255
EQUAL_SYMBOL=256
GREATER_SYMBOL=257
LESS_SYMBOL=258
EXCLAMATION_SYMBOL=259
BIT_NOT_OP=260
BIT_OR_OP=261
BIT_AND_OP=262
BIT_XOR_OP=263
DOT=264
LS_BRACKET=265
RS_BRACKET=266
LR_BRACKET=267
RR_BRACKET=268
COMMA=269
SEMICOLON=270
AT_SIGN=271
SINGLE_QUOTE_SYMB=272
DOUBLE_QUOTE_SYMB=273
REVERSE_QUOTE_SYMB=274
COLON_SYMB=275
ASTERISK_SIGN=276
UNDERLINE_SIGN=277
HYPNEN_SIGN=278
ADD_SIGN=279
PENCENT_SIGN=280
DOUBLE_VERTICAL_SIGN=281
DOUBLE_HYPNEN_SIGN=282
SLASH_SIGN=283
DOT_ID=284
PLUS_DOT_ID=285
STRING_LITERAL=286
DIG_LITERAL=287
REAL_LITERAL=288
BIT_STRING=289
ID_LITERAL=290
PLUS_ID_LITERAL=291
'SELECT'=4
'FROM'=5
'ADD'=6
@ -430,194 +404,168 @@ PLUS_ID_LITERAL=317
'IF'=116
'POSITION'=117
'EXTRACT'=118
'EQ'=119
'NSEQ'=120
'NEQ'=121
'NEQJ'=122
'LT'=123
'LTE'=124
'GT'=125
'GTE'=126
'PLUS'=127
'MINUS'=128
'ASTERISK'=129
'SLASH'=130
'PERCENT'=131
'DIV'=132
'TILDE'=133
'AMPERSAND'=134
'PIPE'=135
'CONCAT_PIPE'=136
'HAT'=137
'PERCENTLIT'=138
'BUCKET'=139
'OUT'=140
'OF'=141
'SORT'=142
'CLUSTER'=143
'DISTRIBUTE'=144
'OVERWRITE'=145
'TRANSFORM'=146
'REDUCE'=147
'USING'=148
'SERDE'=149
'SERDEPROPERTIES'=150
'RECORDREADER'=151
'RECORDWRITER'=152
'DELIMITED'=153
'FIELDS'=154
'TERMINATED'=155
'COLLECTION'=156
'ITEMS'=157
'KEYS'=158
'ESCAPED'=159
'LINES'=160
'SEPARATED'=161
'FUNCTION'=162
'EXTENDED'=163
'REFRESH'=164
'CLEAR'=165
'CACHE'=166
'UNCACHE'=167
'LAZY'=168
'FORMATTED'=169
'GLOBAL'=170
'TEMPORARY'=171
'OPTIONS'=172
'UNSET'=173
'TBLPROPERTIES'=174
'DBPROPERTIES'=175
'BUCKETS'=176
'SKEWED'=177
'STORED'=178
'DIRECTORIES'=179
'LOCATION'=180
'EXCHANGE'=181
'ARCHIVE'=182
'UNARCHIVE'=183
'FILEFORMAT'=184
'TOUCH'=185
'COMPACT'=186
'CONCATENATE'=187
'CHANGE'=188
'CASCADE'=189
'CONSTRAINT'=190
'RESTRICT'=191
'CLUSTERED'=192
'SORTED'=193
'PURGE'=194
'INPUTFORMAT'=195
'OUTPUTFORMAT'=196
'DATABASE'=197
'DATABASES'=198
'DFS'=199
'TRUNCATE'=200
'ANALYZE'=201
'COMPUTE'=202
'LIST'=203
'STATISTICS'=204
'PARTITIONED'=205
'EXTERNAL'=206
'DEFINED'=207
'REVOKE'=208
'GRANT'=209
'LOCK'=210
'UNLOCK'=211
'MSCK'=212
'REPAIR'=213
'RECOVER'=214
'EXPORT'=215
'IMPORT'=216
'LOAD'=217
'ROLE'=218
'ROLES'=219
'COMPACTIONS'=220
'PRINCIPALS'=221
'TRANSACTIONS'=222
'INDEX'=223
'INDEXES'=224
'LOCKS'=225
'OPTION'=226
'ANTI'=227
'LOCAL'=228
'INPATH'=229
'WATERMARK'=230
'UNNEST'=231
'MATCH_RECOGNIZE'=232
'MEASURES'=233
'ONE'=234
'PER'=235
'MATCH'=236
'SKIP1'=237
'NEXT'=238
'PAST'=239
'PATTERN'=240
'WITHIN'=241
'DEFINE'=242
'WS'=243
'SYSTEM'=244
'INCLUDING'=245
'EXCLUDING'=246
'CONSTRAINTS'=247
'OVERWRITING'=248
'GENERATED'=249
'CATALOG'=250
'LANGUAGE'=251
'CATALOGS'=252
'VIEWS'=253
'PRIMARY'=254
'KEY'=255
'PERIOD'=256
'SYSTEM_TIME'=257
'STRING'=258
'ARRAY'=259
'MAP'=260
'CHAR'=261
'VARCHAR'=262
'BINARY'=263
'VARBINARY'=264
'BYTES'=265
'DECIMAL'=266
'TINYINT'=267
'SMALLINT'=268
'INT'=269
'BIGINT'=270
'FLOAT'=271
'DOUBLE'=272
'DATE'=273
'TIME'=274
'TIMESTAMP'=275
'MULTISET'=276
'BOOLEAN'=277
'RAW'=278
'ROW'=279
'NULL'=280
'DATETIME'=281
'='=282
'>'=283
'<'=284
'!'=285
'~'=286
'|'=287
'&'=288
'^'=289
'.'=290
'['=291
']'=292
'('=293
')'=294
','=295
';'=296
'@'=297
'\''=298
'"'=299
'`'=300
':'=301
'*'=302
'_'=303
'-'=304
'+'=305
'%'=306
'||'=307
'--'=308
'/'=309
'MINUS'=119
'DIV'=120
'PERCENTLIT'=121
'BUCKET'=122
'OUT'=123
'OF'=124
'SORT'=125
'CLUSTER'=126
'DISTRIBUTE'=127
'OVERWRITE'=128
'TRANSFORM'=129
'REDUCE'=130
'USING'=131
'SERDE'=132
'SERDEPROPERTIES'=133
'RECORDREADER'=134
'RECORDWRITER'=135
'DELIMITED'=136
'FIELDS'=137
'TERMINATED'=138
'COLLECTION'=139
'ITEMS'=140
'KEYS'=141
'ESCAPED'=142
'LINES'=143
'SEPARATED'=144
'FUNCTION'=145
'EXTENDED'=146
'REFRESH'=147
'CLEAR'=148
'CACHE'=149
'UNCACHE'=150
'LAZY'=151
'FORMATTED'=152
'GLOBAL'=153
'TEMPORARY'=154
'OPTIONS'=155
'UNSET'=156
'TBLPROPERTIES'=157
'DBPROPERTIES'=158
'BUCKETS'=159
'SKEWED'=160
'STORED'=161
'DIRECTORIES'=162
'LOCATION'=163
'EXCHANGE'=164
'ARCHIVE'=165
'UNARCHIVE'=166
'FILEFORMAT'=167
'TOUCH'=168
'COMPACT'=169
'CONCATENATE'=170
'CHANGE'=171
'CASCADE'=172
'CONSTRAINT'=173
'RESTRICT'=174
'CLUSTERED'=175
'SORTED'=176
'PURGE'=177
'INPUTFORMAT'=178
'OUTPUTFORMAT'=179
'DATABASE'=180
'DATABASES'=181
'DFS'=182
'TRUNCATE'=183
'ANALYZE'=184
'COMPUTE'=185
'LIST'=186
'STATISTICS'=187
'PARTITIONED'=188
'EXTERNAL'=189
'DEFINED'=190
'REVOKE'=191
'GRANT'=192
'LOCK'=193
'UNLOCK'=194
'MSCK'=195
'REPAIR'=196
'RECOVER'=197
'EXPORT'=198
'IMPORT'=199
'LOAD'=200
'ROLE'=201
'ROLES'=202
'COMPACTIONS'=203
'PRINCIPALS'=204
'TRANSACTIONS'=205
'INDEX'=206
'INDEXES'=207
'LOCKS'=208
'OPTION'=209
'ANTI'=210
'LOCAL'=211
'INPATH'=212
'WATERMARK'=213
'UNNEST'=214
'MATCH'=215
'NEXT'=216
'WITHIN'=217
'WS'=218
'SYSTEM'=219
'INCLUDING'=220
'EXCLUDING'=221
'CONSTRAINTS'=222
'GENERATED'=223
'CATALOG'=224
'LANGUAGE'=225
'CATALOGS'=226
'VIEWS'=227
'PRIMARY'=228
'KEY'=229
'PERIOD'=230
'SYSTEM_TIME'=231
'STRING'=232
'ARRAY'=233
'MAP'=234
'CHAR'=235
'VARCHAR'=236
'BINARY'=237
'VARBINARY'=238
'BYTES'=239
'DECIMAL'=240
'TINYINT'=241
'SMALLINT'=242
'INT'=243
'BIGINT'=244
'FLOAT'=245
'DOUBLE'=246
'DATE'=247
'TIME'=248
'TIMESTAMP'=249
'MULTISET'=250
'BOOLEAN'=251
'RAW'=252
'ROW'=253
'NULL'=254
'DATETIME'=255
'='=256
'>'=257
'<'=258
'!'=259
'~'=260
'|'=261
'&'=262
'^'=263
'.'=264
'['=265
']'=266
'('=267
')'=268
','=269
';'=270
'@'=271
'\''=272
'"'=273
'`'=274
':'=275
'*'=276
'_'=277
'-'=278
'+'=279
'%'=280
'||'=281
'--'=282
'/'=283

View File

@ -1010,6 +1010,24 @@ FlinkSqlParserListener.prototype.exitQuotedIdentifierAlternative = function(ctx)
};
// Enter a parse tree produced by FlinkSqlParser#ansiNonReservedKeywords.
FlinkSqlParserListener.prototype.enterAnsiNonReservedKeywords = function(ctx) {
};
// Exit a parse tree produced by FlinkSqlParser#ansiNonReservedKeywords.
FlinkSqlParserListener.prototype.exitAnsiNonReservedKeywords = function(ctx) {
};
// Enter a parse tree produced by FlinkSqlParser#nonReservedKeywords.
FlinkSqlParserListener.prototype.enterNonReservedKeywords = function(ctx) {
};
// Exit a parse tree produced by FlinkSqlParser#nonReservedKeywords.
FlinkSqlParserListener.prototype.exitNonReservedKeywords = function(ctx) {
};
// Enter a parse tree produced by FlinkSqlParser#unquotedIdentifier.
FlinkSqlParserListener.prototype.enterUnquotedIdentifier = function(ctx) {
};
@ -1226,5 +1244,32 @@ FlinkSqlParserListener.prototype.exitSetQuantifier = function(ctx) {
};
// Enter a parse tree produced by FlinkSqlParser#ansiNonReserved.
FlinkSqlParserListener.prototype.enterAnsiNonReserved = function(ctx) {
};
// Exit a parse tree produced by FlinkSqlParser#ansiNonReserved.
FlinkSqlParserListener.prototype.exitAnsiNonReserved = function(ctx) {
};
// Enter a parse tree produced by FlinkSqlParser#strictNonReserved.
FlinkSqlParserListener.prototype.enterStrictNonReserved = function(ctx) {
};
// Exit a parse tree produced by FlinkSqlParser#strictNonReserved.
FlinkSqlParserListener.prototype.exitStrictNonReserved = function(ctx) {
};
// Enter a parse tree produced by FlinkSqlParser#nonReserved.
FlinkSqlParserListener.prototype.enterNonReserved = function(ctx) {
};
// Exit a parse tree produced by FlinkSqlParser#nonReserved.
FlinkSqlParserListener.prototype.exitNonReserved = function(ctx) {
};
exports.FlinkSqlParserListener = FlinkSqlParserListener;

View File

@ -678,6 +678,18 @@ FlinkSqlParserVisitor.prototype.visitQuotedIdentifierAlternative = function(ctx)
};
// Visit a parse tree produced by FlinkSqlParser#ansiNonReservedKeywords.
FlinkSqlParserVisitor.prototype.visitAnsiNonReservedKeywords = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#nonReservedKeywords.
FlinkSqlParserVisitor.prototype.visitNonReservedKeywords = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#unquotedIdentifier.
FlinkSqlParserVisitor.prototype.visitUnquotedIdentifier = function(ctx) {
return this.visitChildren(ctx);
@ -822,5 +834,23 @@ FlinkSqlParserVisitor.prototype.visitSetQuantifier = function(ctx) {
};
// Visit a parse tree produced by FlinkSqlParser#ansiNonReserved.
FlinkSqlParserVisitor.prototype.visitAnsiNonReserved = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#strictNonReserved.
FlinkSqlParserVisitor.prototype.visitStrictNonReserved = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#nonReserved.
FlinkSqlParserVisitor.prototype.visitNonReserved = function(ctx) {
return this.visitChildren(ctx);
};
exports.FlinkSqlParserVisitor = FlinkSqlParserVisitor;

View File

@ -173,7 +173,7 @@ describe('FlinkSQL Syntax Tests', () => {
expect(result.length).toBe(0);
});
// todo 字段中包含特殊字符 如$符号 内容匹配不准确 自定义字段与与定义的词法规则重复 也会匹配不准确
// todo 字段中包含特殊字符 如$符号 内容匹配不准确
// test('Test complex sql Statement one', () => {
// const sql = sqlMockData.sqlStrOne;
// const result = parser.validate(sql);