Merge branch 'dev' into feat_sparkSql

This commit is contained in:
xigua 2020-12-17 14:59:52 +08:00
commit 8418c42c26
36 changed files with 46392 additions and 15210 deletions

View File

@ -11,6 +11,7 @@ const entry = [
'plsql',
'spark',
'impala',
'flinksql',
];
entry.forEach((language) => {

View File

@ -0,0 +1,332 @@
lexer grammar FlinkSqlLexer;
// SKIP
SPACE: [ \t\r\n]+ -> channel(HIDDEN);
COMMENT_INPUT: '/*' .*? '*/' -> channel(HIDDEN);
LINE_COMMENT: (
('-- ' | '#') ~[\r\n]* ('\r'? '\n' | EOF)
| '--' ('\r'? '\n' | EOF)
) -> channel(HIDDEN);
// Common Keywords
SELECT: 'SELECT';
FROM: 'FROM';
ADD: 'ADD';
AS: 'AS';
ALL: 'ALL';
ANY: 'ANY';
DISTINCT: 'DISTINCT';
WHERE: 'WHERE';
GROUP: 'GROUP';
BY: 'BY';
GROUPING: 'GROUPING';
SETS: 'SETS';
CUBE: 'CUBE';
ROLLUP: 'ROLLUP';
ORDER: 'ORDER';
HAVING: 'HAVING';
LIMIT: 'LIMIT';
AT: 'AT';
OR: 'OR';
AND: 'AND';
IN: 'IN';
NOT: 'NOT';
NO: 'NO';
EXISTS: 'EXISTS';
BETWEEN: 'BETWEEN';
LIKE: 'LIKE';
RLIKE: 'RLIKE';
IS: 'IS';
TRUE: 'TRUE';
FALSE: 'FALSE';
NULLS: 'NULLS';
ASC: 'ASC';
DESC: 'DESC';
FOR: 'FOR';
INTERVAL: 'INTERVAL';
CASE: 'CASE';
WHEN: 'WHEN';
THEN: 'THEN';
ELSE: 'ELSE';
END: 'END';
JOIN: 'JOIN';
CROSS: 'CROSS';
OUTER: 'OUTER';
INNER: 'INNER';
LEFT: 'LEFT';
SEMI: 'SEMI';
RIGHT: 'RIGHT';
FULL: 'FULL';
NATURAL: 'NATURAL';
ON: 'ON';
PIVOT: 'PIVOT';
LATERAL: 'LATERAL';
WINDOW: 'WINDOW';
OVER: 'OVER';
PARTITION: 'PARTITION';
RANGE: 'RANGE';
ROWS: 'ROWS';
UNBOUNDED: 'UNBOUNDED';
PRECEDING: 'PRECEDING';
FOLLOWING: 'FOLLOWING';
CURRENT: 'CURRENT';
FIRST: 'FIRST';
AFTER: 'AFTER';
LAST: 'LAST';
WITH: 'WITH';
VALUES: 'VALUES';
CREATE: 'CREATE';
TABLE: 'TABLE';
DIRECTORY: 'DIRECTORY';
VIEW: 'VIEW';
REPLACE: 'REPLACE';
INSERT: 'INSERT';
DELETE: 'DELETE';
INTO: 'INTO';
DESCRIBE: 'DESCRIBE';
EXPLAIN: 'EXPLAIN';
FORMAT: 'FORMAT';
LOGICAL: 'LOGICAL';
CODEGEN: 'CODEGEN';
COST: 'COST';
CAST: 'CAST';
SHOW: 'SHOW';
TABLES: 'TABLES';
COLUMNS: 'COLUMNS';
COLUMN: 'COLUMN';
USE: 'USE';
PARTITIONS: 'PARTITIONS';
FUNCTIONS: 'FUNCTIONS';
DROP: 'DROP';
UNION: 'UNION';
EXCEPT: 'EXCEPT';
SETMINUS: 'SETMINUS';
INTERSECT: 'INTERSECT';
TO: 'TO';
TABLESAMPLE: 'TABLESAMPLE';
STRATIFY: 'STRATIFY';
ALTER: 'ALTER';
RENAME: 'RENAME';
STRUCT: 'STRUCT';
COMMENT: 'COMMENT';
SET: 'SET';
RESET: 'RESET';
DATA: 'DATA';
START: 'START';
TRANSACTION: 'TRANSACTION';
COMMIT: 'COMMIT';
ROLLBACK: 'ROLLBACK';
MACRO: 'MACRO';
IGNORE: 'IGNORE';
BOTH: 'BOTH';
LEADING: 'LEADING';
TRAILING: 'TRAILING';
IF: 'IF';
POSITION: 'POSITION';
EXTRACT: 'EXTRACT';
MINUS: 'MINUS';
DIV: 'DIV';
PERCENTLIT: 'PERCENTLIT';
BUCKET: 'BUCKET';
OUT: 'OUT';
OF: 'OF';
SORT: 'SORT';
CLUSTER: 'CLUSTER';
DISTRIBUTE: 'DISTRIBUTE';
OVERWRITE: 'OVERWRITE';
TRANSFORM: 'TRANSFORM';
REDUCE: 'REDUCE';
USING: 'USING';
SERDE: 'SERDE';
SERDEPROPERTIES: 'SERDEPROPERTIES';
RECORDREADER: 'RECORDREADER';
RECORDWRITER: 'RECORDWRITER';
DELIMITED: 'DELIMITED';
FIELDS: 'FIELDS';
TERMINATED: 'TERMINATED';
COLLECTION: 'COLLECTION';
ITEMS: 'ITEMS';
KEYS: 'KEYS';
ESCAPED: 'ESCAPED';
LINES: 'LINES';
SEPARATED: 'SEPARATED';
FUNCTION: 'FUNCTION';
EXTENDED: 'EXTENDED';
REFRESH: 'REFRESH';
CLEAR: 'CLEAR';
CACHE: 'CACHE';
UNCACHE: 'UNCACHE';
LAZY: 'LAZY';
FORMATTED: 'FORMATTED';
GLOBAL: 'GLOBAL';
TEMPORARY: 'TEMPORARY';
OPTIONS: 'OPTIONS';
UNSET: 'UNSET';
TBLPROPERTIES: 'TBLPROPERTIES';
DBPROPERTIES: 'DBPROPERTIES';
BUCKETS: 'BUCKETS';
SKEWED: 'SKEWED';
STORED: 'STORED';
DIRECTORIES: 'DIRECTORIES';
LOCATION: 'LOCATION';
EXCHANGE: 'EXCHANGE';
ARCHIVE: 'ARCHIVE';
UNARCHIVE: 'UNARCHIVE';
FILEFORMAT: 'FILEFORMAT';
TOUCH: 'TOUCH';
COMPACT: 'COMPACT';
CONCATENATE: 'CONCATENATE';
CHANGE: 'CHANGE';
CASCADE: 'CASCADE';
CONSTRAINT: 'CONSTRAINT';
RESTRICT: 'RESTRICT';
CLUSTERED: 'CLUSTERED';
SORTED: 'SORTED';
PURGE: 'PURGE';
INPUTFORMAT: 'INPUTFORMAT';
OUTPUTFORMAT: 'OUTPUTFORMAT';
DATABASE: 'DATABASE';
DATABASES: 'DATABASES';
DFS: 'DFS';
TRUNCATE: 'TRUNCATE';
ANALYZE: 'ANALYZE';
COMPUTE: 'COMPUTE';
LIST: 'LIST';
STATISTICS: 'STATISTICS';
PARTITIONED: 'PARTITIONED';
EXTERNAL: 'EXTERNAL';
DEFINED: 'DEFINED';
REVOKE: 'REVOKE';
GRANT: 'GRANT';
LOCK: 'LOCK';
UNLOCK: 'UNLOCK';
MSCK: 'MSCK';
REPAIR: 'REPAIR';
RECOVER: 'RECOVER';
EXPORT: 'EXPORT';
IMPORT: 'IMPORT';
LOAD: 'LOAD';
ROLE: 'ROLE';
ROLES: 'ROLES';
COMPACTIONS: 'COMPACTIONS';
PRINCIPALS: 'PRINCIPALS';
TRANSACTIONS: 'TRANSACTIONS';
INDEX: 'INDEX';
INDEXES: 'INDEXES';
LOCKS: 'LOCKS';
OPTION: 'OPTION';
ANTI: 'ANTI';
LOCAL: 'LOCAL';
INPATH: 'INPATH';
WATERMARK: 'WATERMARK';
UNNEST: 'UNNEST';
MATCH: 'MATCH';
NEXT: 'NEXT';
WITHIN: 'WITHIN';
WS: 'WS';
SYSTEM: 'SYSTEM';
INCLUDING: 'INCLUDING';
EXCLUDING: 'EXCLUDING';
CONSTRAINTS: 'CONSTRAINTS';
GENERATED: 'GENERATED';
CATALOG: 'CATALOG';
LANGUAGE: 'LANGUAGE';
CATALOGS: 'CATALOGS';
VIEWS: 'VIEWS';
PRIMARY: 'PRIMARY';
KEY: 'KEY';
PERIOD: 'PERIOD';
SYSTEM_TIME: 'SYSTEM_TIME';
// DATA TYPE Keywords
STRING: 'STRING';
ARRAY: 'ARRAY';
MAP: 'MAP';
CHAR: 'CHAR';
VARCHAR: 'VARCHAR';
BINARY: 'BINARY';
VARBINARY: 'VARBINARY';
BYTES: 'BYTES';
DECIMAL: 'DECIMAL';
TINYINT: 'TINYINT';
SMALLINT: 'SMALLINT';
INT: 'INT';
BIGINT: 'BIGINT';
FLOAT: 'FLOAT';
DOUBLE: 'DOUBLE';
DATE: 'DATE';
TIME: 'TIME';
TIMESTAMP: 'TIMESTAMP';
MULTISET: 'MULTISET';
BOOLEAN: 'BOOLEAN';
RAW: 'RAW';
ROW: 'ROW';
NULL: 'NULL';
DATETIME: 'DATETIME'; // 数栈自定义类型
// Operators. Comparation
EQUAL_SYMBOL: '=';
GREATER_SYMBOL: '>';
LESS_SYMBOL: '<';
EXCLAMATION_SYMBOL: '!';
// Operators. Bit
BIT_NOT_OP: '~';
BIT_OR_OP: '|';
BIT_AND_OP: '&';
BIT_XOR_OP: '^';
// Constructors symbols
DOT: '.';
LS_BRACKET: '[';
RS_BRACKET: ']';
LR_BRACKET: '(';
RR_BRACKET: ')';
COMMA: ',';
SEMICOLON: ';';
AT_SIGN: '@';
SINGLE_QUOTE_SYMB: '\'';
DOUBLE_QUOTE_SYMB: '"';
REVERSE_QUOTE_SYMB: '`';
COLON_SYMB: ':';
ASTERISK_SIGN: '*';
UNDERLINE_SIGN: '_';
HYPNEN_SIGN: '-';
ADD_SIGN: '+';
PENCENT_SIGN: '%';
DOUBLE_VERTICAL_SIGN: '||';
DOUBLE_HYPNEN_SIGN: '--';
SLASH_SIGN: '/';
DOT_ID: '.' ID_LITERAL_FRAG;
PLUS_DOT_ID: (':' | '.') PLUS_ID_LITERAL;
STRING_LITERAL: DQUOTA_STRING | SQUOTA_STRING | BQUOTA_STRING;
DIG_LITERAL: DEC_DIGIT+;
REAL_LITERAL: (DEC_DIGIT+)? '.' DEC_DIGIT+
| DEC_DIGIT+ '.' EXPONENT_NUM_PART
| (DEC_DIGIT+)? '.' (DEC_DIGIT+ EXPONENT_NUM_PART)
| DEC_DIGIT+ EXPONENT_NUM_PART;
BIT_STRING: BIT_STRING_L;
ID_LITERAL: ID_LITERAL_FRAG;
PLUS_ID_LITERAL: PLUS_ID_LITERAL_FRAG;
fragment EXPONENT_NUM_PART: 'E' [-+]? DEC_DIGIT+;
fragment ID_LITERAL_FRAG: [A-Z_0-9a-z]*?[A-Z_a-z]+?[A-Z_0-9a-z]*;
fragment PLUS_ID_LITERAL_FRAG: [A-Z_0-9a-z*@#^$%&{}]*?[A-Z_a-z*@#^$%&{}]+?[A-Z_0-9a-z*@#^$%&{}]*;
fragment DEC_DIGIT: [0-9];
fragment DEC_LETTER: [A-Za-z];
fragment DQUOTA_STRING: '"' ( '\\'. | '""' | ~('"'| '\\') )* '"';
fragment SQUOTA_STRING: '\'' ('\\'. | '\'\'' | ~('\'' | '\\'))* '\'';
fragment BIT_STRING_L: 'B' '\'' [01]+ '\'';
fragment BQUOTA_STRING: '`' ( '\\'. | '``' | ~('`'|'\\'))* '`';

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,9 @@
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -13,14 +15,17 @@
limitations under the License.
*/
// HPL/SQL Procedural SQL Extension Grammar
grammar HiveSql;
parser grammar HiveSql;
options {
tokenVocab=HiveSqlLexer;
}
program: block EOF;
@parser::members {
this._input = input;
}
program : block EOF;
block : ((begin_end_block | stmt) T_GO?)+ ; // Multiple consecutive blocks/statements
@ -34,7 +39,7 @@ single_block_stmt : // Single BEGIN END blo
;
block_end :
{!this._input.LT(2).getText().equalsIgnoreCase("TRANSACTION")}? T_END
{!this._input.LT(2).text.toUpperCase() === "TRANSACTION"}? T_END
;
proc_block :
@ -108,7 +113,7 @@ stmt :
semicolon_stmt :
T_SEMICOLON
| '@' | '#' | '/'
| T_CALLS | T_SHARP | T_DIV
;
exception_block : // Exception block
@ -124,7 +129,7 @@ null_stmt : // NULL statement (no operation)
;
expr_stmt : // Standalone expression
{!this._input.LT(1).getText().equalsIgnoreCase("GO")}? expr
{this._input.LT(1).text.toUpperCase() !== "GO"}? expr
;
assignment_stmt : // Assignment statement
@ -229,7 +234,7 @@ create_local_temp_table_stmt :
;
create_table_definition :
(T_AS? T_OPEN_P select_stmt T_CLOSE_P | T_AS? select_stmt | T_OPEN_P create_table_columns T_CLOSE_P | T_LIKE table_name) create_table_options?
(T_AS? T_OPEN_P select_stmt T_CLOSE_P | T_AS? select_stmt | T_OPEN_P create_table_columns T_CLOSE_P) create_table_options?
;
create_table_columns :
@ -365,7 +370,6 @@ alter_table_add_constraint_item :
dtype : // Data types
T_CHAR
| T_CHARACTER
| T_BIGINT
| T_BINARY_DOUBLE
| T_BINARY_FLOAT
@ -401,7 +405,7 @@ dtype : // Data types
| T_VARCHAR
| T_VARCHAR2
| T_XML
| ident ('%' (T_TYPE | T_ROWTYPE))? // User-defined or derived data type
| ident (T_PRECENT (T_TYPE | T_ROWTYPE))? // User-defined or derived data type
;
dtype_len : // Data type length or size specification
@ -471,9 +475,9 @@ create_procedure_stmt :
create_routine_params :
T_OPEN_P T_CLOSE_P
| T_OPEN_P create_routine_param_item (T_COMMA create_routine_param_item)* T_CLOSE_P
| {!this._input.LT(1).getText().equalsIgnoreCase("IS") &&
!this._input.LT(1).getText().equalsIgnoreCase("AS") &&
!(this._input.LT(1).getText().equalsIgnoreCase("DYNAMIC") && this._input.LT(2).getText().equalsIgnoreCase("RESULT"))
| {this._input.LT(1).text.toUpperCase() !== "IS" &&
this._input.LT(1).text.toUpperCase() !== "AS" &&
!(this._input.LT(1).text.toUpperCase() ==="DYNAMIC" && this._input.LT(2).text.toUpperCase() === "RESULT")
}?
create_routine_param_item (T_COMMA create_routine_param_item)*
;
@ -520,7 +524,7 @@ if_tsql_stmt :
;
if_bteq_stmt :
'.' T_IF bool_expr T_THEN single_block_stmt
T_DOT T_IF bool_expr T_THEN single_block_stmt
;
elseif_block :
@ -675,7 +679,7 @@ print_stmt : // PRINT statement
;
quit_stmt :
'.'? T_QUIT expr?
T_DOT? T_QUIT expr?
;
raise_stmt :
@ -811,7 +815,7 @@ select_list_item :
;
select_list_alias :
{!this._input.LT(1).getText().equalsIgnoreCase("INTO") && !this._input.LT(1).getText().equalsIgnoreCase("FROM")}? T_AS? ident
{this._input.LT(1).text.toUpperCase() !== "INTO" && this._input.LT(1).text.toUpperCase() !== "FROM"}? T_AS? ident
| T_OPEN_P T_TITLE L_S_STRING T_CLOSE_P
;
@ -861,14 +865,15 @@ from_table_values_row:
;
from_alias_clause :
{!this._input.LT(1).getText().equalsIgnoreCase("EXEC") &&
!this._input.LT(1).getText().equalsIgnoreCase("EXECUTE") &&
!this._input.LT(1).getText().equalsIgnoreCase("INNER") &&
!this._input.LT(1).getText().equalsIgnoreCase("LEFT") &&
!this._input.LT(1).getText().equalsIgnoreCase("GROUP") &&
!this._input.LT(1).getText().equalsIgnoreCase("ORDER") &&
!this._input.LT(1).getText().equalsIgnoreCase("LIMIT") &&
!this._input.LT(1).getText().equalsIgnoreCase("WITH")}?
{this._input.LT(1).text.toUpperCase() !== "EXEC" &&
this._input.LT(1).text.toUpperCase() !== "EXECUTE" &&
this._input.LT(1).text.toUpperCase() !== "INNER" &&
this._input.LT(1).text.toUpperCase() !== "LEFT" &&
this._input.LT(1).text.toUpperCase() !== "GROUP" &&
this._input.LT(1).text.toUpperCase() !== "ORDER" &&
this._input.LT(1).text.toUpperCase() !== "LIMIT" &&
this._input.LT(1).text.toUpperCase() !== "WITH" &&
this._input.LT(1).text.toUpperCase() !== "JOIN"}?
T_AS? ident (T_OPEN_P L_ID (T_COMMA L_ID)* T_CLOSE_P)?
;
@ -945,7 +950,7 @@ delete_stmt :
;
delete_alias :
{!this._input.LT(1).getText().equalsIgnoreCase("ALL")}?
{this._input.LT(1).text.toUpperCase() !== "ALL"}?
T_AS? ident
;
@ -1070,7 +1075,7 @@ expr_case_searched :
;
expr_cursor_attribute :
ident '%' (T_ISOPEN | T_FOUND | T_NOTFOUND)
ident T_PRECENT (T_ISOPEN | T_FOUND | T_NOTFOUND)
;
expr_agg_window_func :
@ -1136,7 +1141,7 @@ expr_func_params :
;
func_param :
{!this._input.LT(1).getText().equalsIgnoreCase("INTO")}? (ident T_EQUAL T_GREATER?)? expr
{this._input.LT(1).text.toUpperCase() !== "INTO"}? (ident T_EQUAL T_GREATER?)? expr
;
expr_select :
@ -1160,7 +1165,7 @@ hive_item :
;
host :
'!' host_cmd ';' // OS command
T_NOTE host_cmd ';' // OS command
| host_stmt
;
@ -1173,7 +1178,7 @@ host_stmt :
;
file_name :
L_FILE | ('/' | '.' '/')? ident ('/' ident)*
L_FILE | ('/' | T_DOT '/')? ident ('/' ident)*
;
date_literal : // DATE 'YYYY-MM-DD' literal
@ -1185,7 +1190,7 @@ timestamp_literal : // TIMESTAMP 'YYYY-MM-DD HH:MI:SS.FFF'
;
ident :
'-'? (L_ID | non_reserved_words) ('.' (L_ID | non_reserved_words))*
(L_ID | non_reserved_words) (T_DOT (L_ID | non_reserved_words))*
;
string : // String literal (single or double quoted)
@ -1538,3 +1543,4 @@ non_reserved_words : // Tokens that are not reserved words
| T_XML
| T_YES
;

View File

@ -1,3 +1,4 @@
lexer grammar HiveSqlLexer;
// Lexer rules
@ -347,9 +348,12 @@ T_COLON : ':' ;
T_COMMA : ',' ;
T_PIPE : '||' ;
T_DIV : '/' ;
T_DOT : '.' ;
T_DOT2 : '..' ;
T_EQUAL : '=' ;
T_EQUAL2 : '==' ;
T_SHARP : '#' ;
T_NOTE : '!' ;
T_NOTEQUAL : '<>' ;
T_NOTEQUAL2 : '!=' ;
T_GREATER : '>' ;
@ -357,6 +361,8 @@ T_GREATEREQUAL : '>=' ;
T_LESS : '<' ;
T_LESSEQUAL : '<=' ;
T_MUL : '*' ;
T_PRECENT : '%' ;
T_CALLS : '@' ;
T_OPEN_B : '{' ;
T_OPEN_P : '(' ;
T_OPEN_SB : '[' ;

View File

@ -1,3 +0,0 @@
# Hive SQL Grammar
Source file from [Hive Github](https://github.com/apache/hive/tree/master/hplsql/src/main/antlr4/org/apache/hive/hplsql)

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,571 @@
SPACE=1
COMMENT_INPUT=2
LINE_COMMENT=3
SELECT=4
FROM=5
ADD=6
AS=7
ALL=8
ANY=9
DISTINCT=10
WHERE=11
GROUP=12
BY=13
GROUPING=14
SETS=15
CUBE=16
ROLLUP=17
ORDER=18
HAVING=19
LIMIT=20
AT=21
OR=22
AND=23
IN=24
NOT=25
NO=26
EXISTS=27
BETWEEN=28
LIKE=29
RLIKE=30
IS=31
TRUE=32
FALSE=33
NULLS=34
ASC=35
DESC=36
FOR=37
INTERVAL=38
CASE=39
WHEN=40
THEN=41
ELSE=42
END=43
JOIN=44
CROSS=45
OUTER=46
INNER=47
LEFT=48
SEMI=49
RIGHT=50
FULL=51
NATURAL=52
ON=53
PIVOT=54
LATERAL=55
WINDOW=56
OVER=57
PARTITION=58
RANGE=59
ROWS=60
UNBOUNDED=61
PRECEDING=62
FOLLOWING=63
CURRENT=64
FIRST=65
AFTER=66
LAST=67
WITH=68
VALUES=69
CREATE=70
TABLE=71
DIRECTORY=72
VIEW=73
REPLACE=74
INSERT=75
DELETE=76
INTO=77
DESCRIBE=78
EXPLAIN=79
FORMAT=80
LOGICAL=81
CODEGEN=82
COST=83
CAST=84
SHOW=85
TABLES=86
COLUMNS=87
COLUMN=88
USE=89
PARTITIONS=90
FUNCTIONS=91
DROP=92
UNION=93
EXCEPT=94
SETMINUS=95
INTERSECT=96
TO=97
TABLESAMPLE=98
STRATIFY=99
ALTER=100
RENAME=101
STRUCT=102
COMMENT=103
SET=104
RESET=105
DATA=106
START=107
TRANSACTION=108
COMMIT=109
ROLLBACK=110
MACRO=111
IGNORE=112
BOTH=113
LEADING=114
TRAILING=115
IF=116
POSITION=117
EXTRACT=118
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
'AS'=7
'ALL'=8
'ANY'=9
'DISTINCT'=10
'WHERE'=11
'GROUP'=12
'BY'=13
'GROUPING'=14
'SETS'=15
'CUBE'=16
'ROLLUP'=17
'ORDER'=18
'HAVING'=19
'LIMIT'=20
'AT'=21
'OR'=22
'AND'=23
'IN'=24
'NOT'=25
'NO'=26
'EXISTS'=27
'BETWEEN'=28
'LIKE'=29
'RLIKE'=30
'IS'=31
'TRUE'=32
'FALSE'=33
'NULLS'=34
'ASC'=35
'DESC'=36
'FOR'=37
'INTERVAL'=38
'CASE'=39
'WHEN'=40
'THEN'=41
'ELSE'=42
'END'=43
'JOIN'=44
'CROSS'=45
'OUTER'=46
'INNER'=47
'LEFT'=48
'SEMI'=49
'RIGHT'=50
'FULL'=51
'NATURAL'=52
'ON'=53
'PIVOT'=54
'LATERAL'=55
'WINDOW'=56
'OVER'=57
'PARTITION'=58
'RANGE'=59
'ROWS'=60
'UNBOUNDED'=61
'PRECEDING'=62
'FOLLOWING'=63
'CURRENT'=64
'FIRST'=65
'AFTER'=66
'LAST'=67
'WITH'=68
'VALUES'=69
'CREATE'=70
'TABLE'=71
'DIRECTORY'=72
'VIEW'=73
'REPLACE'=74
'INSERT'=75
'DELETE'=76
'INTO'=77
'DESCRIBE'=78
'EXPLAIN'=79
'FORMAT'=80
'LOGICAL'=81
'CODEGEN'=82
'COST'=83
'CAST'=84
'SHOW'=85
'TABLES'=86
'COLUMNS'=87
'COLUMN'=88
'USE'=89
'PARTITIONS'=90
'FUNCTIONS'=91
'DROP'=92
'UNION'=93
'EXCEPT'=94
'SETMINUS'=95
'INTERSECT'=96
'TO'=97
'TABLESAMPLE'=98
'STRATIFY'=99
'ALTER'=100
'RENAME'=101
'STRUCT'=102
'COMMENT'=103
'SET'=104
'RESET'=105
'DATA'=106
'START'=107
'TRANSACTION'=108
'COMMIT'=109
'ROLLBACK'=110
'MACRO'=111
'IGNORE'=112
'BOTH'=113
'LEADING'=114
'TRAILING'=115
'IF'=116
'POSITION'=117
'EXTRACT'=118
'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

@ -0,0 +1,571 @@
SPACE=1
COMMENT_INPUT=2
LINE_COMMENT=3
SELECT=4
FROM=5
ADD=6
AS=7
ALL=8
ANY=9
DISTINCT=10
WHERE=11
GROUP=12
BY=13
GROUPING=14
SETS=15
CUBE=16
ROLLUP=17
ORDER=18
HAVING=19
LIMIT=20
AT=21
OR=22
AND=23
IN=24
NOT=25
NO=26
EXISTS=27
BETWEEN=28
LIKE=29
RLIKE=30
IS=31
TRUE=32
FALSE=33
NULLS=34
ASC=35
DESC=36
FOR=37
INTERVAL=38
CASE=39
WHEN=40
THEN=41
ELSE=42
END=43
JOIN=44
CROSS=45
OUTER=46
INNER=47
LEFT=48
SEMI=49
RIGHT=50
FULL=51
NATURAL=52
ON=53
PIVOT=54
LATERAL=55
WINDOW=56
OVER=57
PARTITION=58
RANGE=59
ROWS=60
UNBOUNDED=61
PRECEDING=62
FOLLOWING=63
CURRENT=64
FIRST=65
AFTER=66
LAST=67
WITH=68
VALUES=69
CREATE=70
TABLE=71
DIRECTORY=72
VIEW=73
REPLACE=74
INSERT=75
DELETE=76
INTO=77
DESCRIBE=78
EXPLAIN=79
FORMAT=80
LOGICAL=81
CODEGEN=82
COST=83
CAST=84
SHOW=85
TABLES=86
COLUMNS=87
COLUMN=88
USE=89
PARTITIONS=90
FUNCTIONS=91
DROP=92
UNION=93
EXCEPT=94
SETMINUS=95
INTERSECT=96
TO=97
TABLESAMPLE=98
STRATIFY=99
ALTER=100
RENAME=101
STRUCT=102
COMMENT=103
SET=104
RESET=105
DATA=106
START=107
TRANSACTION=108
COMMIT=109
ROLLBACK=110
MACRO=111
IGNORE=112
BOTH=113
LEADING=114
TRAILING=115
IF=116
POSITION=117
EXTRACT=118
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
'AS'=7
'ALL'=8
'ANY'=9
'DISTINCT'=10
'WHERE'=11
'GROUP'=12
'BY'=13
'GROUPING'=14
'SETS'=15
'CUBE'=16
'ROLLUP'=17
'ORDER'=18
'HAVING'=19
'LIMIT'=20
'AT'=21
'OR'=22
'AND'=23
'IN'=24
'NOT'=25
'NO'=26
'EXISTS'=27
'BETWEEN'=28
'LIKE'=29
'RLIKE'=30
'IS'=31
'TRUE'=32
'FALSE'=33
'NULLS'=34
'ASC'=35
'DESC'=36
'FOR'=37
'INTERVAL'=38
'CASE'=39
'WHEN'=40
'THEN'=41
'ELSE'=42
'END'=43
'JOIN'=44
'CROSS'=45
'OUTER'=46
'INNER'=47
'LEFT'=48
'SEMI'=49
'RIGHT'=50
'FULL'=51
'NATURAL'=52
'ON'=53
'PIVOT'=54
'LATERAL'=55
'WINDOW'=56
'OVER'=57
'PARTITION'=58
'RANGE'=59
'ROWS'=60
'UNBOUNDED'=61
'PRECEDING'=62
'FOLLOWING'=63
'CURRENT'=64
'FIRST'=65
'AFTER'=66
'LAST'=67
'WITH'=68
'VALUES'=69
'CREATE'=70
'TABLE'=71
'DIRECTORY'=72
'VIEW'=73
'REPLACE'=74
'INSERT'=75
'DELETE'=76
'INTO'=77
'DESCRIBE'=78
'EXPLAIN'=79
'FORMAT'=80
'LOGICAL'=81
'CODEGEN'=82
'COST'=83
'CAST'=84
'SHOW'=85
'TABLES'=86
'COLUMNS'=87
'COLUMN'=88
'USE'=89
'PARTITIONS'=90
'FUNCTIONS'=91
'DROP'=92
'UNION'=93
'EXCEPT'=94
'SETMINUS'=95
'INTERSECT'=96
'TO'=97
'TABLESAMPLE'=98
'STRATIFY'=99
'ALTER'=100
'RENAME'=101
'STRUCT'=102
'COMMENT'=103
'SET'=104
'RESET'=105
'DATA'=106
'START'=107
'TRANSACTION'=108
'COMMIT'=109
'ROLLBACK'=110
'MACRO'=111
'IGNORE'=112
'BOTH'=113
'LEADING'=114
'TRAILING'=115
'IF'=116
'POSITION'=117
'EXTRACT'=118
'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 it is too large Load Diff

View File

@ -0,0 +1,856 @@
// Generated from /Users/erindeng/Desktop/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.8
// jshint ignore: start
var antlr4 = require('antlr4/index');
// This class defines a complete generic visitor for a parse tree produced by FlinkSqlParser.
function FlinkSqlParserVisitor() {
antlr4.tree.ParseTreeVisitor.call(this);
return this;
}
FlinkSqlParserVisitor.prototype = Object.create(antlr4.tree.ParseTreeVisitor.prototype);
FlinkSqlParserVisitor.prototype.constructor = FlinkSqlParserVisitor;
// Visit a parse tree produced by FlinkSqlParser#program.
FlinkSqlParserVisitor.prototype.visitProgram = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#statement.
FlinkSqlParserVisitor.prototype.visitStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#sqlStatements.
FlinkSqlParserVisitor.prototype.visitSqlStatements = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#sqlStatement.
FlinkSqlParserVisitor.prototype.visitSqlStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#emptyStatement.
FlinkSqlParserVisitor.prototype.visitEmptyStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#ddlStatement.
FlinkSqlParserVisitor.prototype.visitDdlStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#dmlStatement.
FlinkSqlParserVisitor.prototype.visitDmlStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#describeStatement.
FlinkSqlParserVisitor.prototype.visitDescribeStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#explainStatement.
FlinkSqlParserVisitor.prototype.visitExplainStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#useStatement.
FlinkSqlParserVisitor.prototype.visitUseStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#showStatememt.
FlinkSqlParserVisitor.prototype.visitShowStatememt = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#createTable.
FlinkSqlParserVisitor.prototype.visitCreateTable = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#columnOptionDefinition.
FlinkSqlParserVisitor.prototype.visitColumnOptionDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#columnName.
FlinkSqlParserVisitor.prototype.visitColumnName = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#columnNameList.
FlinkSqlParserVisitor.prototype.visitColumnNameList = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#columnType.
FlinkSqlParserVisitor.prototype.visitColumnType = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#lengthOneDimension.
FlinkSqlParserVisitor.prototype.visitLengthOneDimension = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#commentSpec.
FlinkSqlParserVisitor.prototype.visitCommentSpec = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#watermarkDefinition.
FlinkSqlParserVisitor.prototype.visitWatermarkDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#tableConstraint.
FlinkSqlParserVisitor.prototype.visitTableConstraint = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#selfDefinitionClause.
FlinkSqlParserVisitor.prototype.visitSelfDefinitionClause = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#partitionDefinition.
FlinkSqlParserVisitor.prototype.visitPartitionDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#transformList.
FlinkSqlParserVisitor.prototype.visitTransformList = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#identityTransform.
FlinkSqlParserVisitor.prototype.visitIdentityTransform = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#applyTransform.
FlinkSqlParserVisitor.prototype.visitApplyTransform = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#transformArgument.
FlinkSqlParserVisitor.prototype.visitTransformArgument = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#likeDefinition.
FlinkSqlParserVisitor.prototype.visitLikeDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#likeOption.
FlinkSqlParserVisitor.prototype.visitLikeOption = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#createCatalog.
FlinkSqlParserVisitor.prototype.visitCreateCatalog = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#createDatabase.
FlinkSqlParserVisitor.prototype.visitCreateDatabase = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#createView.
FlinkSqlParserVisitor.prototype.visitCreateView = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#createFunction.
FlinkSqlParserVisitor.prototype.visitCreateFunction = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#alterTable.
FlinkSqlParserVisitor.prototype.visitAlterTable = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#renameDefinition.
FlinkSqlParserVisitor.prototype.visitRenameDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#setKeyValueDefinition.
FlinkSqlParserVisitor.prototype.visitSetKeyValueDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#alterDatabase.
FlinkSqlParserVisitor.prototype.visitAlterDatabase = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#alterFunction.
FlinkSqlParserVisitor.prototype.visitAlterFunction = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#dropTable.
FlinkSqlParserVisitor.prototype.visitDropTable = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#dropDatabase.
FlinkSqlParserVisitor.prototype.visitDropDatabase = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#dropView.
FlinkSqlParserVisitor.prototype.visitDropView = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#dropFunction.
FlinkSqlParserVisitor.prototype.visitDropFunction = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#insertStatement.
FlinkSqlParserVisitor.prototype.visitInsertStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#insertPartitionDefinition.
FlinkSqlParserVisitor.prototype.visitInsertPartitionDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#valuesDefinition.
FlinkSqlParserVisitor.prototype.visitValuesDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#valuesRowDefinition.
FlinkSqlParserVisitor.prototype.visitValuesRowDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#queryStatement.
FlinkSqlParserVisitor.prototype.visitQueryStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#valuesCaluse.
FlinkSqlParserVisitor.prototype.visitValuesCaluse = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#selectStatement.
FlinkSqlParserVisitor.prototype.visitSelectStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#selectClause.
FlinkSqlParserVisitor.prototype.visitSelectClause = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#projectItemDefinition.
FlinkSqlParserVisitor.prototype.visitProjectItemDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#fromClause.
FlinkSqlParserVisitor.prototype.visitFromClause = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#tableExpression.
FlinkSqlParserVisitor.prototype.visitTableExpression = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#tableReference.
FlinkSqlParserVisitor.prototype.visitTableReference = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#tablePrimary.
FlinkSqlParserVisitor.prototype.visitTablePrimary = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#joinCondition.
FlinkSqlParserVisitor.prototype.visitJoinCondition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#whereClause.
FlinkSqlParserVisitor.prototype.visitWhereClause = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#groupByClause.
FlinkSqlParserVisitor.prototype.visitGroupByClause = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#groupItemDefinition.
FlinkSqlParserVisitor.prototype.visitGroupItemDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#havingClause.
FlinkSqlParserVisitor.prototype.visitHavingClause = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#orderByCaluse.
FlinkSqlParserVisitor.prototype.visitOrderByCaluse = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#orderItemDefition.
FlinkSqlParserVisitor.prototype.visitOrderItemDefition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#limitClause.
FlinkSqlParserVisitor.prototype.visitLimitClause = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#windowClause.
FlinkSqlParserVisitor.prototype.visitWindowClause = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#namedWindow.
FlinkSqlParserVisitor.prototype.visitNamedWindow = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#windowSpec.
FlinkSqlParserVisitor.prototype.visitWindowSpec = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#sortItem.
FlinkSqlParserVisitor.prototype.visitSortItem = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#windowFrame.
FlinkSqlParserVisitor.prototype.visitWindowFrame = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#frameBound.
FlinkSqlParserVisitor.prototype.visitFrameBound = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#expression.
FlinkSqlParserVisitor.prototype.visitExpression = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#logicalNot.
FlinkSqlParserVisitor.prototype.visitLogicalNot = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#predicated.
FlinkSqlParserVisitor.prototype.visitPredicated = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#exists.
FlinkSqlParserVisitor.prototype.visitExists = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#logicalBinary.
FlinkSqlParserVisitor.prototype.visitLogicalBinary = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#predicate.
FlinkSqlParserVisitor.prototype.visitPredicate = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#valueExpressionDefault.
FlinkSqlParserVisitor.prototype.visitValueExpressionDefault = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#comparison.
FlinkSqlParserVisitor.prototype.visitComparison = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#arithmeticBinary.
FlinkSqlParserVisitor.prototype.visitArithmeticBinary = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#arithmeticUnary.
FlinkSqlParserVisitor.prototype.visitArithmeticUnary = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#dereference.
FlinkSqlParserVisitor.prototype.visitDereference = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#simpleCase.
FlinkSqlParserVisitor.prototype.visitSimpleCase = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#columnReference.
FlinkSqlParserVisitor.prototype.visitColumnReference = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#last.
FlinkSqlParserVisitor.prototype.visitLast = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#star.
FlinkSqlParserVisitor.prototype.visitStar = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#subscript.
FlinkSqlParserVisitor.prototype.visitSubscript = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#subqueryExpression.
FlinkSqlParserVisitor.prototype.visitSubqueryExpression = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#cast.
FlinkSqlParserVisitor.prototype.visitCast = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#constantDefault.
FlinkSqlParserVisitor.prototype.visitConstantDefault = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#parenthesizedExpression.
FlinkSqlParserVisitor.prototype.visitParenthesizedExpression = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#functionCall.
FlinkSqlParserVisitor.prototype.visitFunctionCall = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#searchedCase.
FlinkSqlParserVisitor.prototype.visitSearchedCase = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#position.
FlinkSqlParserVisitor.prototype.visitPosition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#first.
FlinkSqlParserVisitor.prototype.visitFirst = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#functionName.
FlinkSqlParserVisitor.prototype.visitFunctionName = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#dereferenceDefinition.
FlinkSqlParserVisitor.prototype.visitDereferenceDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#qualifiedName.
FlinkSqlParserVisitor.prototype.visitQualifiedName = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#interval.
FlinkSqlParserVisitor.prototype.visitInterval = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#errorCapturingMultiUnitsInterval.
FlinkSqlParserVisitor.prototype.visitErrorCapturingMultiUnitsInterval = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#multiUnitsInterval.
FlinkSqlParserVisitor.prototype.visitMultiUnitsInterval = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#errorCapturingUnitToUnitInterval.
FlinkSqlParserVisitor.prototype.visitErrorCapturingUnitToUnitInterval = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#unitToUnitInterval.
FlinkSqlParserVisitor.prototype.visitUnitToUnitInterval = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#intervalValue.
FlinkSqlParserVisitor.prototype.visitIntervalValue = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#columnAlias.
FlinkSqlParserVisitor.prototype.visitColumnAlias = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#tableAlias.
FlinkSqlParserVisitor.prototype.visitTableAlias = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#errorCapturingIdentifier.
FlinkSqlParserVisitor.prototype.visitErrorCapturingIdentifier = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#errorIdent.
FlinkSqlParserVisitor.prototype.visitErrorIdent = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#realIdent.
FlinkSqlParserVisitor.prototype.visitRealIdent = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#identifierList.
FlinkSqlParserVisitor.prototype.visitIdentifierList = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#identifierSeq.
FlinkSqlParserVisitor.prototype.visitIdentifierSeq = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#identifier.
FlinkSqlParserVisitor.prototype.visitIdentifier = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#unquotedIdentifierAlternative.
FlinkSqlParserVisitor.prototype.visitUnquotedIdentifierAlternative = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#quotedIdentifierAlternative.
FlinkSqlParserVisitor.prototype.visitQuotedIdentifierAlternative = function(ctx) {
return this.visitChildren(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);
};
// Visit a parse tree produced by FlinkSqlParser#quotedIdentifier.
FlinkSqlParserVisitor.prototype.visitQuotedIdentifier = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#whenClause.
FlinkSqlParserVisitor.prototype.visitWhenClause = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#uidList.
FlinkSqlParserVisitor.prototype.visitUidList = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#uid.
FlinkSqlParserVisitor.prototype.visitUid = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#plusUid.
FlinkSqlParserVisitor.prototype.visitPlusUid = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#withOption.
FlinkSqlParserVisitor.prototype.visitWithOption = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#ifNotExists.
FlinkSqlParserVisitor.prototype.visitIfNotExists = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#ifExists.
FlinkSqlParserVisitor.prototype.visitIfExists = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#tablePropertyList.
FlinkSqlParserVisitor.prototype.visitTablePropertyList = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#tableProperty.
FlinkSqlParserVisitor.prototype.visitTableProperty = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#tablePropertyKey.
FlinkSqlParserVisitor.prototype.visitTablePropertyKey = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#tablePropertyValue.
FlinkSqlParserVisitor.prototype.visitTablePropertyValue = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#logicalOperator.
FlinkSqlParserVisitor.prototype.visitLogicalOperator = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#comparisonOperator.
FlinkSqlParserVisitor.prototype.visitComparisonOperator = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#bitOperator.
FlinkSqlParserVisitor.prototype.visitBitOperator = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#mathOperator.
FlinkSqlParserVisitor.prototype.visitMathOperator = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#unaryOperator.
FlinkSqlParserVisitor.prototype.visitUnaryOperator = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#fullColumnName.
FlinkSqlParserVisitor.prototype.visitFullColumnName = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#constant.
FlinkSqlParserVisitor.prototype.visitConstant = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#stringLiteral.
FlinkSqlParserVisitor.prototype.visitStringLiteral = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#decimalLiteral.
FlinkSqlParserVisitor.prototype.visitDecimalLiteral = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#booleanLiteral.
FlinkSqlParserVisitor.prototype.visitBooleanLiteral = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParser#setQuantifier.
FlinkSqlParserVisitor.prototype.visitSetQuantifier = function(ctx) {
return this.visitChildren(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;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,384 +1,404 @@
T__0=1
T__1=2
T__2=3
T__3=4
T__4=5
T__5=6
T__6=7
T__7=8
T__8=9
T__9=10
T_GO=11
T_BEGIN=12
T_SEMICOLON=13
T_END=14
T_EXCEPTION=15
T_WHEN=16
L_ID=17
T_THEN=18
T_NULL=19
T_SET=20
T_COMMA=21
T_COLON=22
T_EQUAL=23
T_OPEN_P=24
T_CLOSE_P=25
T_ALLOCATE=26
T_CURSOR=27
T_FOR=28
T_RESULT=29
T_PROCEDURE=30
T_ASSOCIATE=31
T_LOCATOR=32
T_LOCATORS=33
T_WITH=34
T_TRANSACTION=35
T_BREAK=36
T_CALL=37
T_DECLARE=38
T_AS=39
T_CONSTANT=40
T_CONDITION=41
T_IS=42
T_RETURN=43
T_ONLY=44
T_TO=45
T_CALLER=46
T_CLIENT=47
T_WITHOUT=48
T_CONTINUE=49
T_EXIT=50
T_HANDLER=51
T_SQLEXCEPTION=52
T_SQLWARNING=53
T_NOT=54
T_FOUND=55
T_GLOBAL=56
T_TEMPORARY=57
T_TABLE=58
T_CREATE=59
T_IF=60
T_EXISTS=61
T_LOCAL=62
T_MULTISET=63
T_VOLATILE=64
T_LIKE=65
T_CONSTRAINT=66
T_PRIMARY=67
T_KEY=68
T_UNIQUE=69
T_REFERENCES=70
T_IDENTITY=71
L_INT=72
T_AUTO_INCREMENT=73
T_ENABLE=74
T_CLUSTERED=75
T_ASC=76
T_DESC=77
T_FOREIGN=78
T_ON=79
T_UPDATE=80
T_DELETE=81
T_NO=82
T_ACTION=83
T_RESTRICT=84
T_DEFAULT=85
T_CASCADE=86
T_LOG=87
T_FALLBACK=88
T_COMMIT=89
T_PRESERVE=90
T_ROWS=91
T_SEGMENT=92
T_CREATION=93
T_IMMEDIATE=94
T_DEFERRED=95
T_PCTFREE=96
T_PCTUSED=97
T_INITRANS=98
T_MAXTRANS=99
T_NOCOMPRESS=100
T_LOGGING=101
T_NOLOGGING=102
T_STORAGE=103
T_TABLESPACE=104
T_INDEX=105
T_IN=106
T_REPLACE=107
T_DISTRIBUTE=108
T_BY=109
T_HASH=110
T_LOGGED=111
T_COMPRESS=112
T_YES=113
T_DEFINITION=114
T_DROP=115
T_DATA=116
T_STORED=117
T_ROW=118
T_FORMAT=119
T_DELIMITED=120
T_FIELDS=121
T_TERMINATED=122
T_ESCAPED=123
T_COLLECTION=124
T_ITEMS=125
T_MAP=126
T_KEYS=127
T_LINES=128
T_DEFINED=129
T_TEXTIMAGE_ON=130
T_COMMENT=131
T_CHARACTER=132
T_CHARSET=133
T_ENGINE=134
T_ALTER=135
T_ADD2=136
T_CHAR=137
T_BIGINT=138
T_BINARY_DOUBLE=139
T_BINARY_FLOAT=140
T_BINARY_INTEGER=141
T_BIT=142
T_DATE=143
T_DATETIME=144
T_DEC=145
T_DECIMAL=146
T_DOUBLE=147
T_PRECISION=148
T_FLOAT=149
T_INT=150
T_INT2=151
T_INT4=152
T_INT8=153
T_INTEGER=154
T_NCHAR=155
T_NVARCHAR=156
T_NUMBER=157
T_NUMERIC=158
T_PLS_INTEGER=159
T_REAL=160
T_RESULT_SET_LOCATOR=161
T_VARYING=162
T_SIMPLE_FLOAT=163
T_SIMPLE_DOUBLE=164
T_SIMPLE_INTEGER=165
T_SMALLINT=166
T_SMALLDATETIME=167
T_STRING=168
T_SYS_REFCURSOR=169
T_TIMESTAMP=170
T_TINYINT=171
T_VARCHAR=172
T_VARCHAR2=173
T_XML=174
T_TYPE=175
T_ROWTYPE=176
T_MAX=177
T_BYTE=178
T_CASESPECIFIC=179
T_CS=180
T_DATABASE=181
T_SCHEMA=182
T_LOCATION=183
T_OR=184
T_FUNCTION=185
T_RETURNS=186
T_PACKAGE=187
T_PROC=188
T_BODY=189
T_OUT=190
T_INOUT=191
T_LANGUAGE=192
T_SQL=193
T_SECURITY=194
T_CREATOR=195
T_DEFINER=196
T_INVOKER=197
T_OWNER=198
T_DYNAMIC=199
T_SETS=200
T_EXEC=201
T_EXECUTE=202
T_INTO=203
T_ELSE=204
T_ELSIF=205
T_ELSEIF=206
T_INCLUDE=207
T_INSERT=208
T_OVERWRITE=209
T_VALUES=210
T_DIRECTORY=211
T_GET=212
T_DIAGNOSTICS=213
T_MESSAGE_TEXT=214
T_ROW_COUNT=215
T_GRANT=216
T_ROLE=217
T_LEAVE=218
T_OBJECT=219
T_AT=220
T_OPEN=221
T_FETCH=222
T_FROM=223
T_COLLECT=224
T_STATISTICS=225
T_STATS=226
T_COLUMN=227
T_CLOSE=228
T_CMP=229
T_SUM=230
T_COPY=231
T_HDFS=232
T_BATCHSIZE=233
T_DELIMITER=234
T_SQLINSERT=235
T_IGNORE=236
T_WORK=237
T_PRINT=238
T_QUIT=239
T_RAISE=240
T_RESIGNAL=241
T_SQLSTATE=242
T_VALUE=243
T_ROLLBACK=244
T_CURRENT=245
T_CURRENT_SCHEMA=246
T_ANSI_NULLS=247
T_ANSI_PADDING=248
T_NOCOUNT=249
T_QUOTED_IDENTIFIER=250
T_XACT_ABORT=251
T_OFF=252
T_QUERY_BAND=253
T_NONE=254
T_SESSION=255
T_ACTION=1
T_ADD2=2
T_ALL=3
T_ALLOCATE=4
T_ALTER=5
T_AND=6
T_ANSI_NULLS=7
T_ANSI_PADDING=8
T_AS=9
T_ASC=10
T_ASSOCIATE=11
T_AT=12
T_AUTO_INCREMENT=13
T_AVG=14
T_BATCHSIZE=15
T_BEGIN=16
T_BETWEEN=17
T_BIGINT=18
T_BINARY_DOUBLE=19
T_BINARY_FLOAT=20
T_BINARY_INTEGER=21
T_BIT=22
T_BODY=23
T_BREAK=24
T_BY=25
T_BYTE=26
T_CALL=27
T_CALLER=28
T_CASCADE=29
T_CASE=30
T_CASESPECIFIC=31
T_CAST=32
T_CHAR=33
T_CHARACTER=34
T_CHARSET=35
T_CLIENT=36
T_CLOSE=37
T_CLUSTERED=38
T_CMP=39
T_COLLECT=40
T_COLLECTION=41
T_COLUMN=42
T_COMMENT=43
T_CONSTANT=44
T_COMMIT=45
T_COMPRESS=46
T_CONCAT=47
T_CONDITION=48
T_CONSTRAINT=49
T_CONTINUE=50
T_COPY=51
T_COUNT=52
T_COUNT_BIG=53
T_CREATE=54
T_CREATION=55
T_CREATOR=56
T_CS=57
T_CURRENT=58
T_CURRENT_SCHEMA=59
T_CURSOR=60
T_DATABASE=61
T_DATA=62
T_DATE=63
T_DATETIME=64
T_DAY=65
T_DAYS=66
T_DEC=67
T_DECIMAL=68
T_DECLARE=69
T_DEFAULT=70
T_DEFERRED=71
T_DEFINED=72
T_DEFINER=73
T_DEFINITION=74
T_DELETE=75
T_DELIMITED=76
T_DELIMITER=77
T_DESC=78
T_DESCRIBE=79
T_DIAGNOSTICS=80
T_DIR=81
T_DIRECTORY=82
T_DISTINCT=83
T_DISTRIBUTE=84
T_DO=85
T_DOUBLE=86
T_DROP=87
T_DYNAMIC=88
T_ELSE=89
T_ELSEIF=90
T_ELSIF=91
T_ENABLE=92
T_END=93
T_ENGINE=94
T_ESCAPED=95
T_EXCEPT=96
T_EXEC=97
T_EXECUTE=98
T_EXCEPTION=99
T_EXCLUSIVE=100
T_EXISTS=101
T_EXIT=102
T_FALLBACK=103
T_FALSE=104
T_FETCH=105
T_FIELDS=106
T_FILE=107
T_FILES=108
T_FLOAT=109
T_FOR=110
T_FOREIGN=111
T_FORMAT=112
T_FOUND=113
T_FROM=114
T_FULL=115
T_FUNCTION=116
T_GET=117
T_GLOBAL=118
T_GO=119
T_GRANT=120
T_GROUP=121
T_HANDLER=122
T_HASH=123
T_HAVING=124
T_HDFS=125
T_HIVE=126
T_HOST=127
T_IDENTITY=128
T_IF=129
T_IGNORE=130
T_IMMEDIATE=131
T_IN=132
T_INCLUDE=133
T_INDEX=134
T_INITRANS=135
T_INNER=136
T_INOUT=137
T_INSERT=138
T_INT=139
T_INT2=140
T_INT4=141
T_INT8=142
T_INTEGER=143
T_INTERSECT=144
T_INTERVAL=145
T_INTO=146
T_INVOKER=147
T_IS=148
T_ISOPEN=149
T_ITEMS=150
T_JOIN=151
T_KEEP=152
T_KEY=153
T_KEYS=154
T_LANGUAGE=155
T_LEAVE=156
T_LEFT=157
T_LIKE=158
T_LIMIT=159
T_LINES=160
T_LOCAL=161
T_LOCATION=162
T_LOCATOR=163
T_LOCATORS=164
T_LOCKS=165
T_LOG=166
T_LOGGED=167
T_LOGGING=168
T_LOOP=169
T_MAP=170
T_MATCHED=171
T_MAX=172
T_MAXTRANS=173
T_MERGE=174
T_MESSAGE_TEXT=175
T_MICROSECOND=176
T_MICROSECONDS=177
T_MIN=178
T_MULTISET=179
T_NCHAR=180
T_NEW=181
T_NVARCHAR=182
T_NO=183
T_NOCOUNT=184
T_NOCOMPRESS=185
T_NOLOGGING=186
T_NONE=187
T_NOT=188
T_NOTFOUND=189
T_NULL=190
T_NUMERIC=191
T_NUMBER=192
T_OBJECT=193
T_OFF=194
T_ON=195
T_ONLY=196
T_OPEN=197
T_OR=198
T_ORDER=199
T_OUT=200
T_OUTER=201
T_OVER=202
T_OVERWRITE=203
T_OWNER=204
T_PACKAGE=205
T_PARTITION=206
T_PCTFREE=207
T_PCTUSED=208
T_PLS_INTEGER=209
T_PRECISION=210
T_PRESERVE=211
T_PRIMARY=212
T_PRINT=213
T_PROC=214
T_PROCEDURE=215
T_QUALIFY=216
T_QUERY_BAND=217
T_QUIT=218
T_QUOTED_IDENTIFIER=219
T_RAISE=220
T_REAL=221
T_REFERENCES=222
T_REGEXP=223
T_REPLACE=224
T_RESIGNAL=225
T_RESTRICT=226
T_RESULT=227
T_RESULT_SET_LOCATOR=228
T_RETURN=229
T_RETURNS=230
T_REVERSE=231
T_RIGHT=232
T_RLIKE=233
T_ROLE=234
T_ROLLBACK=235
T_ROW=236
T_ROWS=237
T_ROWTYPE=238
T_ROW_COUNT=239
T_RR=240
T_RS=241
T_PWD=242
T_TRIM=243
T_SCHEMA=244
T_SECOND=245
T_SECONDS=246
T_SECURITY=247
T_SEGMENT=248
T_SEL=249
T_SELECT=250
T_SET=251
T_SESSION=252
T_SESSIONS=253
T_SETS=254
T_SHARE=255
T_SIGNAL=256
T_SUMMARY=257
T_TOP=258
T_LIMIT=259
T_TRUNCATE=260
T_USE=261
T_WHILE=262
T_DO=263
T_LOOP=264
T_REVERSE=265
T_DOT2=266
T_STEP=267
L_LABEL=268
T_LESS=269
T_GREATER=270
T_USING=271
T_UNION=272
T_ALL=273
T_EXCEPT=274
T_INTERSECT=275
T_SELECT=276
T_SEL=277
T_DISTINCT=278
T_TITLE=279
L_S_STRING=280
T_INNER=281
T_JOIN=282
T_LEFT=283
T_RIGHT=284
T_FULL=285
T_OUTER=286
T_WHERE=287
T_GROUP=288
T_HAVING=289
T_QUALIFY=290
T_ORDER=291
T_RR=292
T_RS=293
T_UR=294
T_AND=295
T_KEEP=296
T_EXCLUSIVE=297
T_SHARE=298
T_LOCKS=299
T_MERGE=300
T_MATCHED=301
T_DESCRIBE=302
T_BETWEEN=303
T_EQUAL2=304
T_NOTEQUAL=305
T_NOTEQUAL2=306
T_LESSEQUAL=307
T_GREATEREQUAL=308
T_RLIKE=309
T_REGEXP=310
T_MUL=311
T_DIV=312
T_ADD=313
T_SUB=314
T_INTERVAL=315
T_DAY=316
T_DAYS=317
T_MICROSECOND=318
T_MICROSECONDS=319
T_SECOND=320
T_SECONDS=321
T_PIPE=322
T_CONCAT=323
T_CASE=324
T_ISOPEN=325
T_NOTFOUND=326
T_AVG=327
T_COUNT=328
T_COUNT_BIG=329
T_CUME_DIST=330
T_DENSE_RANK=331
T_FIRST_VALUE=332
T_LAG=333
T_LAST_VALUE=334
T_LEAD=335
T_MIN=336
T_RANK=337
T_ROW_NUMBER=338
T_STDEV=339
T_VAR=340
T_VARIANCE=341
T_OVER=342
T_PARTITION=343
T_ACTIVITY_COUNT=344
T_CAST=345
T_CURRENT_DATE=346
T_CURRENT_TIMESTAMP=347
T_CURRENT_USER=348
T_USER=349
T_MAX_PART_STRING=350
T_MIN_PART_STRING=351
T_MAX_PART_INT=352
T_MIN_PART_INT=353
T_MAX_PART_DATE=354
T_MIN_PART_DATE=355
T_PART_COUNT=356
T_PART_LOC=357
T_TRIM=358
T_SUBSTRING=359
T_SYSDATE=360
T_HIVE=361
T_HOST=362
L_FILE=363
L_D_STRING=364
L_DEC=365
T_TRUE=366
T_FALSE=367
T_DIR=368
T_FILE=369
T_FILES=370
T_NEW=371
T_PWD=372
T_SESSIONS=373
T_SUBDIR=374
'@'=1
'#'=2
'/'=3
'%'=4
'.'=5
'*'=6
'!'=7
';'=8
'-'=9
'+'=10
T_SIMPLE_DOUBLE=257
T_SIMPLE_FLOAT=258
T_SIMPLE_INTEGER=259
T_SMALLDATETIME=260
T_SMALLINT=261
T_SQL=262
T_SQLEXCEPTION=263
T_SQLINSERT=264
T_SQLSTATE=265
T_SQLWARNING=266
T_STATS=267
T_STATISTICS=268
T_STEP=269
T_STORAGE=270
T_STORED=271
T_STRING=272
T_SUBDIR=273
T_SUBSTRING=274
T_SUM=275
T_SUMMARY=276
T_SYS_REFCURSOR=277
T_TABLE=278
T_TABLESPACE=279
T_TEMPORARY=280
T_TERMINATED=281
T_TEXTIMAGE_ON=282
T_THEN=283
T_TIMESTAMP=284
T_TINYINT=285
T_TITLE=286
T_TO=287
T_TOP=288
T_TRANSACTION=289
T_TRUE=290
T_TRUNCATE=291
T_TYPE=292
T_UNION=293
T_UNIQUE=294
T_UPDATE=295
T_UR=296
T_USE=297
T_USING=298
T_VALUE=299
T_VALUES=300
T_VAR=301
T_VARCHAR=302
T_VARCHAR2=303
T_VARYING=304
T_VOLATILE=305
T_WHEN=306
T_WHERE=307
T_WHILE=308
T_WITH=309
T_WITHOUT=310
T_WORK=311
T_XACT_ABORT=312
T_XML=313
T_YES=314
T_ACTIVITY_COUNT=315
T_CUME_DIST=316
T_CURRENT_DATE=317
T_CURRENT_TIMESTAMP=318
T_CURRENT_USER=319
T_DENSE_RANK=320
T_FIRST_VALUE=321
T_LAG=322
T_LAST_VALUE=323
T_LEAD=324
T_MAX_PART_STRING=325
T_MIN_PART_STRING=326
T_MAX_PART_INT=327
T_MIN_PART_INT=328
T_MAX_PART_DATE=329
T_MIN_PART_DATE=330
T_PART_COUNT=331
T_PART_LOC=332
T_RANK=333
T_ROW_NUMBER=334
T_STDEV=335
T_SYSDATE=336
T_VARIANCE=337
T_USER=338
T_ADD=339
T_COLON=340
T_COMMA=341
T_PIPE=342
T_DIV=343
T_DOT=344
T_DOT2=345
T_EQUAL=346
T_EQUAL2=347
T_SHARP=348
T_NOTE=349
T_NOTEQUAL=350
T_NOTEQUAL2=351
T_GREATER=352
T_GREATEREQUAL=353
T_LESS=354
T_LESSEQUAL=355
T_MUL=356
T_PRECENT=357
T_CALLS=358
T_OPEN_B=359
T_OPEN_P=360
T_OPEN_SB=361
T_CLOSE_B=362
T_CLOSE_P=363
T_CLOSE_SB=364
T_SEMICOLON=365
T_SUB=366
L_ID=367
L_S_STRING=368
L_D_STRING=369
L_INT=370
L_DEC=371
L_WS=372
L_M_COMMENT=373
L_S_COMMENT=374
L_FILE=375
L_LABEL=376
'+'=339
':'=340
','=341
'||'=342
'/'=343
'.'=344
'..'=345
'='=346
'=='=347
'#'=348
'!'=349
'<>'=350
'!='=351
'>'=352
'>='=353
'<'=354
'<='=355
'*'=356
'%'=357
'@'=358
'{'=359
'('=360
'['=361
'}'=362
')'=363
']'=364
';'=365
'-'=366

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,404 @@
T__0=1
T__1=2
T__2=3
T__3=4
T__4=5
T__5=6
T__6=7
T__7=8
T__8=9
T__9=10
'@'=1
'#'=2
'/'=3
'%'=4
'.'=5
'*'=6
'!'=7
';'=8
'-'=9
'+'=10
T_ACTION=1
T_ADD2=2
T_ALL=3
T_ALLOCATE=4
T_ALTER=5
T_AND=6
T_ANSI_NULLS=7
T_ANSI_PADDING=8
T_AS=9
T_ASC=10
T_ASSOCIATE=11
T_AT=12
T_AUTO_INCREMENT=13
T_AVG=14
T_BATCHSIZE=15
T_BEGIN=16
T_BETWEEN=17
T_BIGINT=18
T_BINARY_DOUBLE=19
T_BINARY_FLOAT=20
T_BINARY_INTEGER=21
T_BIT=22
T_BODY=23
T_BREAK=24
T_BY=25
T_BYTE=26
T_CALL=27
T_CALLER=28
T_CASCADE=29
T_CASE=30
T_CASESPECIFIC=31
T_CAST=32
T_CHAR=33
T_CHARACTER=34
T_CHARSET=35
T_CLIENT=36
T_CLOSE=37
T_CLUSTERED=38
T_CMP=39
T_COLLECT=40
T_COLLECTION=41
T_COLUMN=42
T_COMMENT=43
T_CONSTANT=44
T_COMMIT=45
T_COMPRESS=46
T_CONCAT=47
T_CONDITION=48
T_CONSTRAINT=49
T_CONTINUE=50
T_COPY=51
T_COUNT=52
T_COUNT_BIG=53
T_CREATE=54
T_CREATION=55
T_CREATOR=56
T_CS=57
T_CURRENT=58
T_CURRENT_SCHEMA=59
T_CURSOR=60
T_DATABASE=61
T_DATA=62
T_DATE=63
T_DATETIME=64
T_DAY=65
T_DAYS=66
T_DEC=67
T_DECIMAL=68
T_DECLARE=69
T_DEFAULT=70
T_DEFERRED=71
T_DEFINED=72
T_DEFINER=73
T_DEFINITION=74
T_DELETE=75
T_DELIMITED=76
T_DELIMITER=77
T_DESC=78
T_DESCRIBE=79
T_DIAGNOSTICS=80
T_DIR=81
T_DIRECTORY=82
T_DISTINCT=83
T_DISTRIBUTE=84
T_DO=85
T_DOUBLE=86
T_DROP=87
T_DYNAMIC=88
T_ELSE=89
T_ELSEIF=90
T_ELSIF=91
T_ENABLE=92
T_END=93
T_ENGINE=94
T_ESCAPED=95
T_EXCEPT=96
T_EXEC=97
T_EXECUTE=98
T_EXCEPTION=99
T_EXCLUSIVE=100
T_EXISTS=101
T_EXIT=102
T_FALLBACK=103
T_FALSE=104
T_FETCH=105
T_FIELDS=106
T_FILE=107
T_FILES=108
T_FLOAT=109
T_FOR=110
T_FOREIGN=111
T_FORMAT=112
T_FOUND=113
T_FROM=114
T_FULL=115
T_FUNCTION=116
T_GET=117
T_GLOBAL=118
T_GO=119
T_GRANT=120
T_GROUP=121
T_HANDLER=122
T_HASH=123
T_HAVING=124
T_HDFS=125
T_HIVE=126
T_HOST=127
T_IDENTITY=128
T_IF=129
T_IGNORE=130
T_IMMEDIATE=131
T_IN=132
T_INCLUDE=133
T_INDEX=134
T_INITRANS=135
T_INNER=136
T_INOUT=137
T_INSERT=138
T_INT=139
T_INT2=140
T_INT4=141
T_INT8=142
T_INTEGER=143
T_INTERSECT=144
T_INTERVAL=145
T_INTO=146
T_INVOKER=147
T_IS=148
T_ISOPEN=149
T_ITEMS=150
T_JOIN=151
T_KEEP=152
T_KEY=153
T_KEYS=154
T_LANGUAGE=155
T_LEAVE=156
T_LEFT=157
T_LIKE=158
T_LIMIT=159
T_LINES=160
T_LOCAL=161
T_LOCATION=162
T_LOCATOR=163
T_LOCATORS=164
T_LOCKS=165
T_LOG=166
T_LOGGED=167
T_LOGGING=168
T_LOOP=169
T_MAP=170
T_MATCHED=171
T_MAX=172
T_MAXTRANS=173
T_MERGE=174
T_MESSAGE_TEXT=175
T_MICROSECOND=176
T_MICROSECONDS=177
T_MIN=178
T_MULTISET=179
T_NCHAR=180
T_NEW=181
T_NVARCHAR=182
T_NO=183
T_NOCOUNT=184
T_NOCOMPRESS=185
T_NOLOGGING=186
T_NONE=187
T_NOT=188
T_NOTFOUND=189
T_NULL=190
T_NUMERIC=191
T_NUMBER=192
T_OBJECT=193
T_OFF=194
T_ON=195
T_ONLY=196
T_OPEN=197
T_OR=198
T_ORDER=199
T_OUT=200
T_OUTER=201
T_OVER=202
T_OVERWRITE=203
T_OWNER=204
T_PACKAGE=205
T_PARTITION=206
T_PCTFREE=207
T_PCTUSED=208
T_PLS_INTEGER=209
T_PRECISION=210
T_PRESERVE=211
T_PRIMARY=212
T_PRINT=213
T_PROC=214
T_PROCEDURE=215
T_QUALIFY=216
T_QUERY_BAND=217
T_QUIT=218
T_QUOTED_IDENTIFIER=219
T_RAISE=220
T_REAL=221
T_REFERENCES=222
T_REGEXP=223
T_REPLACE=224
T_RESIGNAL=225
T_RESTRICT=226
T_RESULT=227
T_RESULT_SET_LOCATOR=228
T_RETURN=229
T_RETURNS=230
T_REVERSE=231
T_RIGHT=232
T_RLIKE=233
T_ROLE=234
T_ROLLBACK=235
T_ROW=236
T_ROWS=237
T_ROWTYPE=238
T_ROW_COUNT=239
T_RR=240
T_RS=241
T_PWD=242
T_TRIM=243
T_SCHEMA=244
T_SECOND=245
T_SECONDS=246
T_SECURITY=247
T_SEGMENT=248
T_SEL=249
T_SELECT=250
T_SET=251
T_SESSION=252
T_SESSIONS=253
T_SETS=254
T_SHARE=255
T_SIGNAL=256
T_SIMPLE_DOUBLE=257
T_SIMPLE_FLOAT=258
T_SIMPLE_INTEGER=259
T_SMALLDATETIME=260
T_SMALLINT=261
T_SQL=262
T_SQLEXCEPTION=263
T_SQLINSERT=264
T_SQLSTATE=265
T_SQLWARNING=266
T_STATS=267
T_STATISTICS=268
T_STEP=269
T_STORAGE=270
T_STORED=271
T_STRING=272
T_SUBDIR=273
T_SUBSTRING=274
T_SUM=275
T_SUMMARY=276
T_SYS_REFCURSOR=277
T_TABLE=278
T_TABLESPACE=279
T_TEMPORARY=280
T_TERMINATED=281
T_TEXTIMAGE_ON=282
T_THEN=283
T_TIMESTAMP=284
T_TINYINT=285
T_TITLE=286
T_TO=287
T_TOP=288
T_TRANSACTION=289
T_TRUE=290
T_TRUNCATE=291
T_TYPE=292
T_UNION=293
T_UNIQUE=294
T_UPDATE=295
T_UR=296
T_USE=297
T_USING=298
T_VALUE=299
T_VALUES=300
T_VAR=301
T_VARCHAR=302
T_VARCHAR2=303
T_VARYING=304
T_VOLATILE=305
T_WHEN=306
T_WHERE=307
T_WHILE=308
T_WITH=309
T_WITHOUT=310
T_WORK=311
T_XACT_ABORT=312
T_XML=313
T_YES=314
T_ACTIVITY_COUNT=315
T_CUME_DIST=316
T_CURRENT_DATE=317
T_CURRENT_TIMESTAMP=318
T_CURRENT_USER=319
T_DENSE_RANK=320
T_FIRST_VALUE=321
T_LAG=322
T_LAST_VALUE=323
T_LEAD=324
T_MAX_PART_STRING=325
T_MIN_PART_STRING=326
T_MAX_PART_INT=327
T_MIN_PART_INT=328
T_MAX_PART_DATE=329
T_MIN_PART_DATE=330
T_PART_COUNT=331
T_PART_LOC=332
T_RANK=333
T_ROW_NUMBER=334
T_STDEV=335
T_SYSDATE=336
T_VARIANCE=337
T_USER=338
T_ADD=339
T_COLON=340
T_COMMA=341
T_PIPE=342
T_DIV=343
T_DOT=344
T_DOT2=345
T_EQUAL=346
T_EQUAL2=347
T_SHARP=348
T_NOTE=349
T_NOTEQUAL=350
T_NOTEQUAL2=351
T_GREATER=352
T_GREATEREQUAL=353
T_LESS=354
T_LESSEQUAL=355
T_MUL=356
T_PRECENT=357
T_CALLS=358
T_OPEN_B=359
T_OPEN_P=360
T_OPEN_SB=361
T_CLOSE_B=362
T_CLOSE_P=363
T_CLOSE_SB=364
T_SEMICOLON=365
T_SUB=366
L_ID=367
L_S_STRING=368
L_D_STRING=369
L_INT=370
L_DEC=371
L_WS=372
L_M_COMMENT=373
L_S_COMMENT=374
L_FILE=375
L_LABEL=376
'+'=339
':'=340
','=341
'||'=342
'/'=343
'.'=344
'..'=345
'='=346
'=='=347
'#'=348
'!'=349
'<>'=350
'!='=351
'>'=352
'>='=353
'<'=354
'<='=355
'*'=356
'%'=357
'@'=358
'{'=359
'('=360
'['=361
'}'=362
')'=363
']'=364
';'=365
'-'=366

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

20
src/parser/flinksql.ts Normal file
View File

@ -0,0 +1,20 @@
import { InputStream, CommonTokenStream, Lexer } from 'antlr4';
import { FlinkSqlLexer } from '../lib/flinksql/FlinkSqlLexer';
import { FlinkSqlParser } from '../lib/flinksql/FlinkSqlParser';
export * from '../lib/flinksql/FlinkSqlParserListener';
export * from '../lib/flinksql/FlinkSqlParserVisitor';
import BasicParser from './common/BasicParser';
export default class FlinkSQL extends BasicParser {
public createLexer(input: string): Lexer {
const chars = new InputStream(input.toUpperCase()); // Some Lexer only support uppercase token, So you need transform
const lexer = <unknown> new FlinkSqlLexer(chars) as Lexer;
return lexer;
}
public createParserFromLexer(lexer: Lexer) {
const tokenStream = new CommonTokenStream(lexer);
return new FlinkSqlParser(tokenStream);
}
}

View File

@ -1,6 +1,6 @@
import { InputStream, CommonTokenStream, Lexer } from 'antlr4';
import { HiveSqlLexer } from '../lib/hive/HiveSqlLexer';
import { HiveSqlParser } from '../lib/hive/HiveSqlParser';
import { HiveSql } from '../lib/hive/HiveSql';
export * from '../lib/hive/HiveSqlListener';
export * from '../lib/hive/HiveSqlVisitor';
@ -14,7 +14,7 @@ export default class HiveSQL extends BasicParser {
}
public createParserFromLexer(lexer: Lexer) {
const tokenStream = new CommonTokenStream(lexer);
return new HiveSqlParser(tokenStream);
return new HiveSql(tokenStream);
}
}

View File

@ -1,3 +1,4 @@
export * from './generic';
export * from './plsql';
export * from './hive';
export * from './flinksql';

View File

@ -1,125 +1,183 @@
function replaceStrFormIndexArr(str, replaceStr, indexArr) {
let result = '';
let index = 0;
if (!indexArr || indexArr.length < 1) {
return str;
}
for (let i = 0; i < indexArr.length; i++) {
const indexItem = indexArr[i];
const begin = indexItem.begin;
import { TokenType, Token, TokenReg } from './token';
result = result + str.substring(index, begin) + replaceStr;
index = indexItem.end + 1;
/**
*
* @param {String} sql
*/
function lexer(input: string): Token[] {
// 记录当前字符的位置
let current = 0;
let line = 1;
// 最终的 TokenTypes 结果
const tokens: Token[] = [];
if (i == indexArr.length - 1) {
result = result + str.substring(index);
/**
* TokenType
*/
// eslint-disable-next-line
const extract = (currentChar: string, validator: RegExp, TokenType: TokenType): Token => {
let value = '';
const start = current;
while (validator.test(currentChar)) {
value += currentChar;
currentChar = input[++current];
}
}
return result;
}
function splitSql(sql: string) {
let haveEnd = true;
if (!sql.endsWith(';')) {
sql += ';';
haveEnd = false;
}
interface splitParser {
index: number;
queue: string;
sqls: number[];
}
function pushSql(parser: splitParser, sql: string) {
if (!haveEnd && parser.index == sql.length - 1) {
parser.sqls.push(parser.index - 1);
parser.queue = '';
} else {
parser.sqls.push(parser.index);
parser.queue = '';
}
}
// 处理引号
function quoteToken(parser: splitParser, sql: string): string {
const queue = parser.queue;
const endsWith = queue[queue.length - 1];
if (endsWith == '\'' || endsWith == '"') {
const nextToken = sql.indexOf(endsWith, parser.index + 1);
if (nextToken != -1) {
parser.index = nextToken;
parser.queue = '';
} else {
parser.index = sql.length - 1;
}
} else {
return null;
}
}
// 处理单行注释
function singleLineCommentToken(parser: splitParser, sql: string): string {
let queue = parser.queue;
if (queue.endsWith('--')) {
const nextToken = sql.indexOf('\n', parser.index + 1);
if (nextToken != -1) {
parser.index = nextToken;
queue = '';
} else {
parser.index = sql.length - 1;
}
} else {
return null;
}
}
// 处理多行注释
function multipleLineCommentToken(
parser: splitParser, sql: string,
): string {
const queue = parser.queue;
if (queue.endsWith('/*')) {
const nextToken = sql.indexOf('*/', parser.index + 1);
if (nextToken != -1) {
parser.index = nextToken + 1;
parser.queue = '';
} else {
parser.index = sql.length - 1;
parser.queue = '';
}
} else {
return null;
}
}
function splitToken(parser: splitParser, sql: string): string {
const queue = parser.queue;
if (queue.endsWith(';')) {
pushSql(parser, sql);
} else {
return null;
}
}
const parser: splitParser = {
index: 0,
queue: '',
sqls: [],
return {
type: TokenType,
start: start,
end: current,
lineNumber: line,
value: value,
};
};
for (parser.index = 0; parser.index < sql.length; parser.index++) {
const char = sql[parser.index];
parser.queue += char;
const tokenFuncs = [
quoteToken,
singleLineCommentToken,
multipleLineCommentToken,
splitToken,
];
for (let i = 0; i < tokenFuncs.length; i++) {
tokenFuncs[i](parser, sql);
/**
*
*/
// eslint-disable-next-line
const matchQuotation = (currentChar: string, validator: RegExp, TokenType: TokenType) => {
do {
if (currentChar === '\n') {
line++;
}
currentChar = input[++current];
} while (!validator.test(currentChar));
++current;
};
while (current < input.length) {
let char = input[current];
// 按顺序处理 换行符 反引号 单引号 双引号 注释 分号
// 引号内 可能包含注释包含的符号以及分号 所以优先处理引号里面的内容 去除干扰信息
if (char === '\n') {
line++;
current++;
continue;
}
if (parser.index == sql.length - 1 && parser.queue) {
pushSql(parser, sql);
if (TokenReg.BackQuotation.test(char)) {
// eslint-disable-next-line
matchQuotation(char, TokenReg.BackQuotation, TokenType.BackQuotation);
continue;
}
if (TokenReg.SingleQuotation.test(char)) {
// eslint-disable-next-line
matchQuotation(char, TokenReg.SingleQuotation, TokenType.SingleQuotation);
continue;
}
if (TokenReg.DoubleQuotation.test(char)) {
// eslint-disable-next-line
matchQuotation(char, TokenReg.DoubleQuotation, TokenType.DoubleQuotation);
continue;
}
// 处理单行注释,以--开始,\n 结束
if (char === '-' && input[current + 1] === '-') {
let value = '';
const start = current;
while (char !== '\n') {
value += char;
char = input[++current];
}
tokens.push({
type: TokenType.Comment,
value,
start: start,
lineNumber: line,
end: current,
});
continue;
}
// 处理多行注释,以 /* 开始, */结束
if (char === '/' && input[current + 1] === '*') {
let value = '';
const start = current;
const startLine = line;
while (!(char === '/' && input[current - 1] === '*')) {
if (char === '\n') {
line++;
}
value += char;
char = input[++current];
}
value += char;
++current;
tokens.push({
type: TokenType.Comment,
value,
start: start,
lineNumber: startLine,
end: current,
});
continue;
}
// 处理结束符 ;
if (TokenReg.StatementTerminator.test(char)) {
const newToken = extract(
char,
TokenReg.StatementTerminator,
TokenType.StatementTerminator,
);
tokens.push(newToken);
continue;
}
current++;
}
return parser.sqls;
return tokens;
}
/**
* sql
* @param {String} sql
*/
function splitSql(sql: string) {
const tokens = lexer(sql);
const sqlArr = [];
let startIndex = 0;
tokens.forEach((ele: Token) => {
if (ele.type === TokenType.StatementTerminator) {
sqlArr.push(sql.slice(startIndex, ele.end));
startIndex = ele.end;
}
});
if (startIndex < sql.length) {
sqlArr.push(sql.slice(startIndex));
}
return sqlArr;
}
/**
*
* @param {String} sql
*/
function cleanSql(sql: string) {
sql.trim(); // 删除前后空格
const tokens = lexer(sql);
let resultSql = '';
let startIndex = 0;
tokens.forEach((ele: Token) => {
if (ele.type === TokenType.Comment) {
resultSql += sql.slice(startIndex, ele.start);
startIndex = ele.end + 1;
}
});
resultSql += sql.slice(startIndex);
return resultSql;
}
export {
replaceStrFormIndexArr,
cleanSql,
splitSql,
lexer,
};

46
src/utils/token.ts Executable file
View File

@ -0,0 +1,46 @@
export enum TokenType {
/**
* Enclosed in single/double/back quotation, `` Symbol
* 'abc', "abc", `abc`
*/
SingleQuotation = 'SingleQuotation',
DoubleQuotation = 'DoubleQuotation',
BackQuotation = 'BackQuotation',
/**
* Language element type
*/
Comment = 'Comment',
/**
* Statement
*/
StatementTerminator = 'StatementTerminator',
/**
* Others
*/
Error = 'Error'
}
/**
* Token object
*/
export interface Token {
type: TokenType,
value: string;
start: number;
end: number;
lineNumber: number;
message?: string;
}
/**
* Token recognition rules
*/
export const TokenReg = {
[TokenType.StatementTerminator]: /[;]/,
[TokenType.SingleQuotation]: /[']/,
[TokenType.DoubleQuotation]: /["]/,
[TokenType.BackQuotation]: /[`]/,
};

View File

@ -0,0 +1,11 @@
import SQLParser from '../../../src/parser/flinksql';
describe('FlinkSQL Lexer tests', () => {
const parser = new SQLParser();
const sql = 'SELECT * FROM table1';
const tokens = parser.getAllTokens(sql);
test('token counts', () => {
expect(tokens.length).toBe(7);
});
});

View File

@ -0,0 +1,24 @@
import
SQLParser, { FlinkSqlParserListener }
from '../../../src/parser/flinksql';
describe('Flink SQL Listener Tests', () => {
const expectTableName = 'user1';
const sql = `select id,name,sex from ${expectTableName};`;
const parser = new SQLParser();
const parserTree = parser.parse(sql);
test('Listener enterTableName', async () => {
let result = '';
class MyListener extends FlinkSqlParserListener {
enterTableExpression(ctx): void {
result = ctx.getText().toLowerCase();
}
}
const listenTableName: any = new MyListener();
await parser.listen(listenTableName, parserTree);
expect(result).toBe(expectTableName);
});
});

View File

@ -0,0 +1,221 @@
import SQLParser from '../../../src/parser/flinksql';
import sqlMockData from '../../mock/flinkSql';
describe('FlinkSQL Syntax Tests', () => {
const parser = new SQLParser();
// Create statements
test('Test simple CreateTable Statement', () => {
const sql = `
CREATE TABLE Orders (
user BIGINT
) WITH (
"connector" = "kafka",
"scan.startup.mode" = "earliest-offset"
);
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test simple CreateDatabase Statement', () => {
const sql = `
CREATE DATABASE IF NOT EXISTS dataApi
WITH (
"owner" = "admin"
);
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test simple CreateView Statement', () => {
const sql = `
CREATE TEMPORARY VIEW IF NOT EXISTS tempView
AS SELECT product, amount FROM Orders;
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test simple CreateFunction Statement', () => {
const sql = `
CREATE TEMPORARY FUNCTION IF NOT EXISTS tempFunction AS 'SimpleUdf';
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
// Alter statements
test('Test simple AlterTable Statement', () => {
const sql = `ALTER TABLE Orders RENAME TO NewOrders;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test simple AlterDatabase Statement', () => {
const sql = `ALTER DATABASE tempDB SET ("key1"="value1");`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test simple AlterFunction Statement', () => {
const sql = `
ALTER TEMPORARY FUNCTION IF EXISTS tempFunction AS 'SimpleUdf';
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
// Drop statements
test('Test simple DropTable Statement', () => {
const sql = `DROP TABLE IF EXISTS Orders;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test simple DropDatabase Statement', () => {
const sql = `DROP DATABASE IF EXISTS Orders RESTRICT;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test simple DropView Statement', () => {
const sql = `DROP TEMPORARY VIEW IF EXISTS Orders;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test simple DropFunction Statement', () => {
const sql = `DROP TEMPORARY FUNCTION IF EXISTS Orders;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
// insert statements
test('Test one simple Insert Statement', () => {
const sql = `
INSERT INTO students VALUES
('Amy Smith', '123 Park Ave, San Jose', 111111);
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test two simple Insert Statement', () => {
const sql = `
INSERT INTO students PARTITION (student_id = 444444)
SELECT name, address FROM persons WHERE name = "Dora Williams";
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
// query statements
test('Test simple Select Statement', () => {
const sql = `SELECT product, amount FROM Orders;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test Select Statement with where clause', () => {
const sql = `SELECT * FROM person WHERE id = 200 OR id = 300;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test Select Statement with group by clause', () => {
const sql = `SELECT id, sum(quantity) FROM dealer GROUP BY id;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test Select Statement with having clause', () => {
const sql = `
SELECT city, sum(quantity) AS sum
FROM dealer GROUP BY city HAVING city = 'Fremont';
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test Select Statement with order by clause', () => {
const sql = `SELECT name, age FROM person ORDER BY age;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test Select Statement with limit clause', () => {
const sql = `SELECT name, age FROM person ORDER BY name LIMIT 2;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test Select Statement with join', () => {
const sql = `
SELECT id, name, employee.deptno, deptname FROM employee
FULL JOIN department ON employee.deptno = department.deptno;
`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
// describe statements
test('Test simple Describe Statement', () => {
const sql = `DESCRIBE Orders;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
// describe statements
test('Test simple Explain Statement', () => {
const sql = `EXPLAIN tempTable FOR SELECT k, SUM(v) FROM oneTable;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
// use statements
test('Test simple Use Statement', () => {
const sql = `USE CATALOG orders;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
// show statements
test('Test simple Show Statement', () => {
const sql = `SHOW CATALOGS;`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test complex sql Statement one', () => {
const sql = sqlMockData.sqlStrOne;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test complex sql Statement two', () => {
const sql = sqlMockData.sqlStrTwo;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test complex sql Statement three', () => {
const sql = sqlMockData.sqlStrThree;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test complex sql Statement four', () => {
const sql = sqlMockData.sqlStrFour;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test complex sql Statement five', () => {
const sql = sqlMockData.sqlStrFive;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test complex sql Statement six', () => {
const sql = sqlMockData.sqlStrSix;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test complex sql Statement seven', () => {
const sql = sqlMockData.sqlStrSeven;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test complex sql Statement eight', () => {
const sql = sqlMockData.sqlStrEight;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Test complex sql Statement nine', () => {
const sql = sqlMockData.allSqlStr;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
});

View File

@ -0,0 +1,27 @@
import SQLParser, { FlinkSqlParserVisitor } from '../../../src/parser/flinksql';
describe('Flink SQL Visitor Tests', () => {
const expectTableName = 'user1';
const sql = `select id,name,sex from ${expectTableName};`;
const parser = new SQLParser();
const parserTree = parser.parse(sql, (error) => {
console.log('Parse error:', error);
});
// console.log('Parser tree string:', parser.toString(parserTree));
test('Visitor visitTableName', () => {
let result = '';
class MyVisitor extends FlinkSqlParserVisitor {
visitTableExpression(ctx): void {
result = ctx.getText().toLowerCase();
super.visitTableExpression(ctx);
}
}
const visitor: any = new MyVisitor();
visitor.visit(parserTree);
expect(result).toBe(expectTableName);
});
});

View File

@ -2,11 +2,15 @@ import SQLParser from '../../../src/parser/hive';
describe('HiveSQL Lexer tests', () => {
const parser = new SQLParser();
// select id,name,sex from user1;
const sql = 'SELECT * FROM t1';
const tokens = parser.getAllTokens(sql);
test('select token counts', () => {
const sql = 'SELECT * FROM t1';
const tokens = parser.getAllTokens(sql);
expect(tokens.length).toBe(4);
});
test('token counts', () => {
expect(tokens.length).toBe(12);
test('select token counts', () => {
const sql = 'show create table_name;';
const tokens = parser.getAllTokens(sql);
expect(tokens.length).toBe(4);
});
});

View File

@ -1,17 +1,16 @@
import SQLParser, { HiveSqlListener } from '../../../src/parser/hive';
describe('Hive SQL Listener Tests', () => {
const expectTableName = 'user1';
const sql = `select id,name,sex from ${expectTableName};`;
const parser = new SQLParser();
test('Listener enterSelectList', async () => {
const expectTableName = 'userName';
const sql = `select ${expectTableName} from user1 where inc_day='20190601' limit 1000;`;
const parserTree = parser.parse(sql);
const parserTree = parser.parse(sql);
test('Listener enterTableName', async () => {
let result = '';
class MyListener extends HiveSqlListener {
enterTableName(ctx): void {
result = ctx.getText().toLowerCase();
enterSelect_list(ctx): void {
result = ctx.getText();
}
}
const listenTableName: any = new MyListener();
@ -19,4 +18,18 @@ describe('Hive SQL Listener Tests', () => {
await parser.listen(listenTableName, parserTree);
expect(result).toBe(expectTableName);
});
test('Listener enterCreateTable', async () => {
const sql = `drop table table_name;`;
const parserTree = parser.parse(sql);
let result = '';
class MyListener extends HiveSqlListener {
enterDrop_stmt(ctx): void {
result = ctx.getText();
}
}
const listenTableName: any = new MyListener();
await parser.listen(listenTableName, parserTree);
expect(result).toBe('droptabletable_name');
});
});

View File

@ -2,17 +2,21 @@ import SQLParser from '../../../src/parser/hive';
describe('Hive SQL Syntax Tests', () => {
const parser = new SQLParser();
test('Select Statement', () => {
const sql = 'SELECT * FROM employee WHERE salary>30000;';
test('Create Table Statement', () => {
const sql = 'CREATE TABLE person(name STRING,age INT);';
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Select 1+1', () => {
const sql = 'SELECT 1+1;';
test('Create Table Statement', () => {
const sql = `alter table dm_gis.table_name add if not exists partition (inc_day = '20190601');`;
const result = parser.validate(sql);
expect(result.length).toBe(0);
});
test('Wrong Select Statement', () => {
const sql = 'SELECT add ABC from Where ;'
const result = parser.validate(sql);
expect(result.length).toBe(2);
expect(result[0].message).toBe(`no viable alternative at input 'SELECTaddABCfromWhere'`)
expect(result[1].message).toBe(`mismatched input 'Where' expecting <EOF>`)
});
});

View File

@ -1,15 +1,15 @@
import SQLParser, { HiveSqlVisitor } from '../../../src/parser/hive';
describe('Generic SQL Visitor Tests', () => {
const expectTableName = 'user1';
const sql = `select id,name,sex from ${expectTableName};`;
const expectTableName = 'dm_gis.dlv_addr_tc_count';
const sql = `select citycode,tc,inc_day from ${expectTableName} where inc_day='20190501' limit 100;`;
const parser = new SQLParser();
const parserTree = parser.parse(sql, (error) => {
console.log('Parse error:', error);
});
console.log('Parser tree string:', parser.toString(parserTree));
// console.log('Parser tree string:', parser.toString(parserTree));
test('Visitor visitTableName', () => {
let result = '';
@ -19,6 +19,7 @@ describe('Generic SQL Visitor Tests', () => {
super.visitTable_name(ctx);
}
}
const visitor: any = new MyVisitor();
visitor.visit(parserTree);

View File

@ -1,48 +1,41 @@
import * as utils from '../../src/utils';
describe('utils', () => {
describe('split sql', () => {
test('single', () => {
let sql = 'select id,name from user';
let result = utils.splitSql(sql);
expect(result).toEqual([sql.length - 1]);
sql += ';';
result = utils.splitSql(sql);
expect(result).toEqual([sql.length - 1]);
});
test('multiple', () => {
const sql = `-- a ;
select * from a;
select user from b`;
const result = utils.splitSql(sql);
expect(result).toEqual([34, 65]);
});
test('error sql', () => {
const sql = `CREATE TABLE MyResult(
a double,
b timestamp,
c timestamp
)WITH(
type ='mysql,
url ='jdbc:mysql://1.1.1.1:3306/hi?charset=utf8',
userName ='name',
password ='123',
tableName ='user'
);`;
const result = utils.splitSql(sql);
expect(result).toEqual([337]);
const sql2 = `CREATE TABLE MyResult(
a double,
b timestamp,
c timestamp
)WITH(
type ='mysql,
url ='jdbc:mysql://1.1.1.1:3306/hi?charset=utf8',
userName ='name',
password ='123',
tableName ='user'
)`;
const result2 = utils.splitSql(sql2);
expect(result2).toEqual([336]);
});
test('split single sql', () => {
const sql = 'select id,name from user';
const result = utils.splitSql(sql);
expect(result.length).toEqual(1);
});
test('split multiple sql', () => {
const sql = `-- a ;
select * from a;
/*
xxx
xxx
*/
select user from b`;
const result = utils.splitSql(sql);
expect(result.length).toEqual(2);
});
test('lexer', () => {
const sql = `-- a ;
select * from a;
/*
xxx
xxx
*/
select user from b;`;
const result = utils.lexer(sql);
expect(result.length).toEqual(4);
});
test('cleanSql', () => {
const sql = `-- a ;
select * from a;
/*
xxx
xxx
*/
select user from b`;
const result = utils.cleanSql(sql);
expect(result.indexOf('xxx')).toEqual(-1);
});
});