feat(flink): add describe/explain/use/show statement and some test

This commit is contained in:
Erindcl 2020-11-26 11:20:57 +08:00
parent d1259b46a0
commit 0ef80696f4
18 changed files with 12318 additions and 19115 deletions

View File

@ -0,0 +1,348 @@
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';
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';
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';
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_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';
CATALOGS: 'CATALOGS';
VIEWS: 'VIEWS';
// 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';
// 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;
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: ID_LITERAL;
fragment EXPONENT_NUM_PART: 'E' [-+]? DEC_DIGIT+;
fragment ID_LITERAL: [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: '`' ( '\\'. | '``' | ~('`'|'\\'))* '`';

View File

@ -1,7 +1,6 @@
grammar FlinkSqlParser;
parser grammar FlinkSqlParser;
// import FlinkSqlLexer;
// options { tokenVocab=FlinkSqlLexer; }
options { tokenVocab=FlinkSqlLexer; }
program: statement EOF;
@ -10,11 +9,11 @@ statement
;
sqlStatements
: (sqlStatement SEMICOLON | emptyStatement)*
: (sqlStatement SEMICOLON? | emptyStatement)*
;
sqlStatement
: ddlStatement | dmlStatement
: ddlStatement | dmlStatement | describeStatement | explainStatement | useStatement | showStatememt
;
emptyStatement
@ -31,6 +30,22 @@ dmlStatement
: queryStatement | insertStatement
;
describeStatement
: DESCRIBE uid
;
explainStatement
: EXPLAIN identifier FOR dmlStatement
;
useStatement
: USE CATALOG? uid
;
showStatememt
: SHOW (CATALOGS | DATABASES | TABLES | FUNCTIONS | VIEWS)
;
// Create statements
@ -111,7 +126,7 @@ createDatabase
;
createView
: CREATE TEMPORARY? VIEW ifNotExists? uid (columnName (',' columnName)*)? commentSpec AS queryStatement
: CREATE TEMPORARY? VIEW ifNotExists? uid (columnName (',' columnName)*)? commentSpec? AS queryStatement
;
createFunction
@ -129,9 +144,7 @@ renameDefinition
;
setKeyValueDefinition
: SET LR_BRACKET
keyValueDefinition (COMMA keyValueDefinition)*
RR_BRACKET
: SET tablePropertyList
;
alterDatabase
@ -139,7 +152,7 @@ alterDatabase
;
alterFunction
:
: ALTER (TEMPORARY|TEMPORARY SYSTEM) FUNCTION ifExists? uid AS identifier (LANGUAGE identifier)?
;
@ -167,15 +180,13 @@ dropFunction
insertStatement
: INSERT (INTO | OVERWRITE) uid
(
insertPartitionDefinition? selectStatement
insertPartitionDefinition? queryStatement
| valuesDefinition
)
;
insertPartitionDefinition
: PARTITION LR_BRACKET
keyValueDefinition (COMMA keyValueDefinition)*
RR_BRACKET
: PARTITION tablePropertyList
;
valuesDefinition
@ -334,7 +345,7 @@ valueExpression
: primaryExpression #valueExpressionDefault
| operator=('-' | '+' | '~') valueExpression #arithmeticUnary
| left=valueExpression operator=('*' | '/' | '%' | DIV) right=valueExpression #arithmeticBinary
| left=valueExpression operator=('+' | '-' | '||') right=valueExpression #arithmeticBinary
| left=valueExpression operator=('+' | '-' | DOUBLE_VERTICAL_SIGN) right=valueExpression #arithmeticBinary
| left=valueExpression operator='&' right=valueExpression #arithmeticBinary
| left=valueExpression operator='^' right=valueExpression #arithmeticBinary
| left=valueExpression operator='|' right=valueExpression #arithmeticBinary
@ -470,10 +481,6 @@ ifNotExists
ifExists
: IF EXISTS;
keyValueDefinition
: STRING_LITERAL EQUAL_SYMBOL STRING_LITERAL
;
tablePropertyList
: '(' tableProperty (',' tableProperty)* ')'
;
@ -544,353 +551,3 @@ setQuantifier
: DISTINCT
| ALL
;
/*
lexer grammar
*/
// 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';
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';
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';
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_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';
// 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';
// 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_HYPNEN_SIGN: '--';
SLASH_SIGN: '/';
DOT_ID: '.' 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: ID_LITERAL;
fragment EXPONENT_NUM_PART: 'E' [-+]? DEC_DIGIT+;
fragment ID_LITERAL: [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 one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -239,82 +239,74 @@ PAST=238
PATTERN=239
WITHIN=240
DEFINE=241
BIGINT_LITERAL=242
SMALLINT_LITERAL=243
TINYINT_LITERAL=244
INTEGER_VALUE=245
DECIMAL_VALUE=246
DOUBLE_LITERAL=247
BIGDECIMAL_LITERAL=248
IDENTIFIER=249
BACKQUOTED_IDENTIFIER=250
SIMPLE_COMMENT=251
BRACKETED_EMPTY_COMMENT=252
BRACKETED_COMMENT=253
WS=254
UNRECOGNIZED=255
SYSTEM=256
STRING=257
ARRAY=258
MAP=259
CHAR=260
VARCHAR=261
BINARY=262
VARBINARY=263
BYTES=264
DECIMAL=265
TINYINT=266
SMALLINT=267
INT=268
BIGINT=269
FLOAT=270
DOUBLE=271
DATE=272
TIME=273
TIMESTAMP=274
MULTISET=275
BOOLEAN=276
RAW=277
ROW=278
NULL=279
EQUAL_SYMBOL=280
GREATER_SYMBOL=281
LESS_SYMBOL=282
EXCLAMATION_SYMBOL=283
BIT_NOT_OP=284
BIT_OR_OP=285
BIT_AND_OP=286
BIT_XOR_OP=287
DOT=288
LS_BRACKET=289
RS_BRACKET=290
LR_BRACKET=291
RR_BRACKET=292
COMMA=293
SEMICOLON=294
AT_SIGN=295
ZERO_DECIMAL=296
ONE_DECIMAL=297
TWO_DECIMAL=298
SINGLE_QUOTE_SYMB=299
DOUBLE_QUOTE_SYMB=300
REVERSE_QUOTE_SYMB=301
COLON_SYMB=302
ASTERISK_SIGN=303
UNDERLINE_SIGN=304
HYPNEN_SIGN=305
ADD_SIGN=306
PENCENT_SIGN=307
DOUBLE_HYPNEN_SIGN=308
SLASH_SIGN=309
DOT_ID=310
ID=311
STRING_LITERAL=312
DECIMAL_LITERAL=313
REAL_LITERAL=314
BIT_STRING=315
IDENTIFIER_BASE=316
DEC_DIGIT=317
WS=242
SYSTEM=243
INCLUDING=244
EXCLUDING=245
CONSTRAINTS=246
OVERWRITING=247
GENERATED=248
CATALOG=249
LANGUAGE=250
CATALOGS=251
VIEWS=252
STRING=253
ARRAY=254
MAP=255
CHAR=256
VARCHAR=257
BINARY=258
VARBINARY=259
BYTES=260
DECIMAL=261
TINYINT=262
SMALLINT=263
INT=264
BIGINT=265
FLOAT=266
DOUBLE=267
DATE=268
TIME=269
TIMESTAMP=270
MULTISET=271
BOOLEAN=272
RAW=273
ROW=274
NULL=275
EQUAL_SYMBOL=276
GREATER_SYMBOL=277
LESS_SYMBOL=278
EXCLAMATION_SYMBOL=279
BIT_NOT_OP=280
BIT_OR_OP=281
BIT_AND_OP=282
BIT_XOR_OP=283
DOT=284
LS_BRACKET=285
RS_BRACKET=286
LR_BRACKET=287
RR_BRACKET=288
COMMA=289
SEMICOLON=290
AT_SIGN=291
SINGLE_QUOTE_SYMB=292
DOUBLE_QUOTE_SYMB=293
REVERSE_QUOTE_SYMB=294
COLON_SYMB=295
ASTERISK_SIGN=296
UNDERLINE_SIGN=297
HYPNEN_SIGN=298
ADD_SIGN=299
PENCENT_SIGN=300
DOUBLE_VERTICAL_SIGN=301
DOUBLE_HYPNEN_SIGN=302
SLASH_SIGN=303
DOT_ID=304
STRING_LITERAL=305
DIG_LITERAL=306
REAL_LITERAL=307
BIT_STRING=308
ID=309
'SELECT'=4
'FROM'=5
'ADD'=6
@ -553,71 +545,65 @@ DEC_DIGIT=317
'PATTERN'=239
'WITHIN'=240
'DEFINE'=241
'BIGINT_LITERAL'=242
'SMALLINT_LITERAL'=243
'TINYINT_LITERAL'=244
'INTEGER_VALUE'=245
'DECIMAL_VALUE'=246
'DOUBLE_LITERAL'=247
'BIGDECIMAL_LITERAL'=248
'IDENTIFIER'=249
'BACKQUOTED_IDENTIFIER'=250
'SIMPLE_COMMENT'=251
'BRACKETED_EMPTY_COMMENT'=252
'BRACKETED_COMMENT'=253
'WS'=254
'UNRECOGNIZED'=255
'SYSTEM'=256
'STRING'=257
'ARRAY'=258
'MAP'=259
'CHAR'=260
'VARCHAR'=261
'BINARY'=262
'VARBINARY'=263
'BYTES'=264
'DECIMAL'=265
'TINYINT'=266
'SMALLINT'=267
'INT'=268
'BIGINT'=269
'FLOAT'=270
'DOUBLE'=271
'DATE'=272
'TIME'=273
'TIMESTAMP'=274
'MULTISET'=275
'BOOLEAN'=276
'RAW'=277
'ROW'=278
'NULL'=279
'='=280
'>'=281
'<'=282
'!'=283
'~'=284
'|'=285
'&'=286
'^'=287
'.'=288
'['=289
']'=290
'('=291
')'=292
','=293
';'=294
'@'=295
'0'=296
'1'=297
'2'=298
'\''=299
'"'=300
'`'=301
':'=302
'*'=303
'_'=304
'-'=305
'+'=306
'%'=307
'--'=308
'/'=309
'WS'=242
'SYSTEM'=243
'INCLUDING'=244
'EXCLUDING'=245
'CONSTRAINTS'=246
'OVERWRITING'=247
'GENERATED'=248
'CATALOG'=249
'LANGUAGE'=250
'CATALOGS'=251
'VIEWS'=252
'STRING'=253
'ARRAY'=254
'MAP'=255
'CHAR'=256
'VARCHAR'=257
'BINARY'=258
'VARBINARY'=259
'BYTES'=260
'DECIMAL'=261
'TINYINT'=262
'SMALLINT'=263
'INT'=264
'BIGINT'=265
'FLOAT'=266
'DOUBLE'=267
'DATE'=268
'TIME'=269
'TIMESTAMP'=270
'MULTISET'=271
'BOOLEAN'=272
'RAW'=273
'ROW'=274
'NULL'=275
'='=276
'>'=277
'<'=278
'!'=279
'~'=280
'|'=281
'&'=282
'^'=283
'.'=284
'['=285
']'=286
'('=287
')'=288
','=289
';'=290
'@'=291
'\''=292
'"'=293
'`'=294
':'=295
'*'=296
'_'=297
'-'=298
'+'=299
'%'=300
'||'=301
'--'=302
'/'=303

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,622 +0,0 @@
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
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
RESTRICT=190
CLUSTERED=191
SORTED=192
PURGE=193
INPUTFORMAT=194
OUTPUTFORMAT=195
DATABASE=196
DATABASES=197
DFS=198
TRUNCATE=199
ANALYZE=200
COMPUTE=201
LIST=202
STATISTICS=203
PARTITIONED=204
EXTERNAL=205
DEFINED=206
REVOKE=207
GRANT=208
LOCK=209
UNLOCK=210
MSCK=211
REPAIR=212
RECOVER=213
EXPORT=214
IMPORT=215
LOAD=216
ROLE=217
ROLES=218
COMPACTIONS=219
PRINCIPALS=220
TRANSACTIONS=221
INDEX=222
INDEXES=223
LOCKS=224
OPTION=225
ANTI=226
LOCAL=227
INPATH=228
WATERMARK=229
UNNEST=230
MATCH_RECOGNIZE=231
MEASURES=232
ONE=233
PER=234
MATCH=235
SKIP1=236
NEXT=237
PAST=238
PATTERN=239
WITHIN=240
DEFINE=241
BIGINT_LITERAL=242
SMALLINT_LITERAL=243
TINYINT_LITERAL=244
INTEGER_VALUE=245
DECIMAL_VALUE=246
DOUBLE_LITERAL=247
BIGDECIMAL_LITERAL=248
IDENTIFIER=249
BACKQUOTED_IDENTIFIER=250
SIMPLE_COMMENT=251
BRACKETED_EMPTY_COMMENT=252
BRACKETED_COMMENT=253
WS=254
UNRECOGNIZED=255
SYSTEM=256
STRING=257
ARRAY=258
MAP=259
CHAR=260
VARCHAR=261
BINARY=262
VARBINARY=263
BYTES=264
DECIMAL=265
TINYINT=266
SMALLINT=267
INT=268
BIGINT=269
FLOAT=270
DOUBLE=271
DATE=272
TIME=273
TIMESTAMP=274
MULTISET=275
BOOLEAN=276
RAW=277
ROW=278
NULL=279
EQUAL_SYMBOL=280
GREATER_SYMBOL=281
LESS_SYMBOL=282
EXCLAMATION_SYMBOL=283
BIT_NOT_OP=284
BIT_OR_OP=285
BIT_AND_OP=286
BIT_XOR_OP=287
DOT=288
LS_BRACKET=289
RS_BRACKET=290
LR_BRACKET=291
RR_BRACKET=292
COMMA=293
SEMICOLON=294
AT_SIGN=295
ZERO_DECIMAL=296
ONE_DECIMAL=297
TWO_DECIMAL=298
SINGLE_QUOTE_SYMB=299
DOUBLE_QUOTE_SYMB=300
REVERSE_QUOTE_SYMB=301
COLON_SYMB=302
ASTERISK_SIGN=303
UNDERLINE_SIGN=304
HYPNEN_SIGN=305
ADD_SIGN=306
PENCENT_SIGN=307
DOUBLE_HYPNEN_SIGN=308
SLASH_SIGN=309
DOT_ID=310
ID=311
STRING_LITERAL=312
DECIMAL_LITERAL=313
REAL_LITERAL=314
BIT_STRING=315
IDENTIFIER_BASE=316
'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
'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
'RESTRICT'=190
'CLUSTERED'=191
'SORTED'=192
'PURGE'=193
'INPUTFORMAT'=194
'OUTPUTFORMAT'=195
'DATABASE'=196
'DATABASES'=197
'DFS'=198
'TRUNCATE'=199
'ANALYZE'=200
'COMPUTE'=201
'LIST'=202
'STATISTICS'=203
'PARTITIONED'=204
'EXTERNAL'=205
'DEFINED'=206
'REVOKE'=207
'GRANT'=208
'LOCK'=209
'UNLOCK'=210
'MSCK'=211
'REPAIR'=212
'RECOVER'=213
'EXPORT'=214
'IMPORT'=215
'LOAD'=216
'ROLE'=217
'ROLES'=218
'COMPACTIONS'=219
'PRINCIPALS'=220
'TRANSACTIONS'=221
'INDEX'=222
'INDEXES'=223
'LOCKS'=224
'OPTION'=225
'ANTI'=226
'LOCAL'=227
'INPATH'=228
'WATERMARK'=229
'UNNEST'=230
'MATCH_RECOGNIZE'=231
'MEASURES'=232
'ONE'=233
'PER'=234
'MATCH'=235
'SKIP1'=236
'NEXT'=237
'PAST'=238
'PATTERN'=239
'WITHIN'=240
'DEFINE'=241
'BIGINT_LITERAL'=242
'SMALLINT_LITERAL'=243
'TINYINT_LITERAL'=244
'INTEGER_VALUE'=245
'DECIMAL_VALUE'=246
'DOUBLE_LITERAL'=247
'BIGDECIMAL_LITERAL'=248
'IDENTIFIER'=249
'BACKQUOTED_IDENTIFIER'=250
'SIMPLE_COMMENT'=251
'BRACKETED_EMPTY_COMMENT'=252
'BRACKETED_COMMENT'=253
'WS'=254
'UNRECOGNIZED'=255
'SYSTEM'=256
'STRING'=257
'ARRAY'=258
'MAP'=259
'CHAR'=260
'VARCHAR'=261
'BINARY'=262
'VARBINARY'=263
'BYTES'=264
'DECIMAL'=265
'TINYINT'=266
'SMALLINT'=267
'INT'=268
'BIGINT'=269
'FLOAT'=270
'DOUBLE'=271
'DATE'=272
'TIME'=273
'TIMESTAMP'=274
'MULTISET'=275
'BOOLEAN'=276
'RAW'=277
'ROW'=278
'NULL'=279
'='=280
'>'=281
'<'=282
'!'=283
'~'=284
'|'=285
'&'=286
'^'=287
'.'=288
'['=289
']'=290
'('=291
')'=292
','=293
';'=294
'@'=295
'0'=296
'1'=297
'2'=298
'\''=299
'"'=300
'`'=301
':'=302
'*'=303
'_'=304
'-'=305
'+'=306
'%'=307
'--'=308
'/'=309

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@
// jshint ignore: start
var antlr4 = require('antlr4/index');
// This class defines a complete generic visitor for a parse tree produced by FlinkSqlParserParser.
// This class defines a complete generic visitor for a parse tree produced by FlinkSqlParser.
function FlinkSqlParserVisitor() {
antlr4.tree.ParseTreeVisitor.call(this);
@ -12,481 +12,775 @@ function FlinkSqlParserVisitor() {
FlinkSqlParserVisitor.prototype = Object.create(antlr4.tree.ParseTreeVisitor.prototype);
FlinkSqlParserVisitor.prototype.constructor = FlinkSqlParserVisitor;
// Visit a parse tree produced by FlinkSqlParserParser#program.
// Visit a parse tree produced by FlinkSqlParser#program.
FlinkSqlParserVisitor.prototype.visitProgram = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#statement.
// Visit a parse tree produced by FlinkSqlParser#statement.
FlinkSqlParserVisitor.prototype.visitStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#sqlStatements.
// Visit a parse tree produced by FlinkSqlParser#sqlStatements.
FlinkSqlParserVisitor.prototype.visitSqlStatements = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#sqlStatement.
// Visit a parse tree produced by FlinkSqlParser#sqlStatement.
FlinkSqlParserVisitor.prototype.visitSqlStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#emptyStatement.
// Visit a parse tree produced by FlinkSqlParser#emptyStatement.
FlinkSqlParserVisitor.prototype.visitEmptyStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#ddlStatement.
// Visit a parse tree produced by FlinkSqlParser#ddlStatement.
FlinkSqlParserVisitor.prototype.visitDdlStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#dmlStatement.
// Visit a parse tree produced by FlinkSqlParser#dmlStatement.
FlinkSqlParserVisitor.prototype.visitDmlStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#createTable.
// 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 FlinkSqlParserParser#columnOptionDefinition.
// Visit a parse tree produced by FlinkSqlParser#columnOptionDefinition.
FlinkSqlParserVisitor.prototype.visitColumnOptionDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#columnName.
// Visit a parse tree produced by FlinkSqlParser#columnName.
FlinkSqlParserVisitor.prototype.visitColumnName = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#columnType.
// Visit a parse tree produced by FlinkSqlParser#columnType.
FlinkSqlParserVisitor.prototype.visitColumnType = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#partitionDefinition.
// 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#partitionDefinition.
FlinkSqlParserVisitor.prototype.visitPartitionDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#partitionColumnDefinition.
FlinkSqlParserVisitor.prototype.visitPartitionColumnDefinition = function(ctx) {
// Visit a parse tree produced by FlinkSqlParser#transformList.
FlinkSqlParserVisitor.prototype.visitTransformList = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#partitionColumnName.
FlinkSqlParserVisitor.prototype.visitPartitionColumnName = function(ctx) {
// Visit a parse tree produced by FlinkSqlParser#identityTransform.
FlinkSqlParserVisitor.prototype.visitIdentityTransform = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#createDatabase.
// 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 FlinkSqlParserParser#createView.
// Visit a parse tree produced by FlinkSqlParser#createView.
FlinkSqlParserVisitor.prototype.visitCreateView = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#createFunction.
// Visit a parse tree produced by FlinkSqlParser#createFunction.
FlinkSqlParserVisitor.prototype.visitCreateFunction = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#alterTable.
// Visit a parse tree produced by FlinkSqlParser#alterTable.
FlinkSqlParserVisitor.prototype.visitAlterTable = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#renameDefinition.
// Visit a parse tree produced by FlinkSqlParser#renameDefinition.
FlinkSqlParserVisitor.prototype.visitRenameDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#setKeyValueDefinition.
// Visit a parse tree produced by FlinkSqlParser#setKeyValueDefinition.
FlinkSqlParserVisitor.prototype.visitSetKeyValueDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#alterDatabase.
// Visit a parse tree produced by FlinkSqlParser#alterDatabase.
FlinkSqlParserVisitor.prototype.visitAlterDatabase = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#alterFunction.
// Visit a parse tree produced by FlinkSqlParser#alterFunction.
FlinkSqlParserVisitor.prototype.visitAlterFunction = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#dropTable.
// Visit a parse tree produced by FlinkSqlParser#dropTable.
FlinkSqlParserVisitor.prototype.visitDropTable = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#dropDatabase.
// Visit a parse tree produced by FlinkSqlParser#dropDatabase.
FlinkSqlParserVisitor.prototype.visitDropDatabase = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#dropView.
// Visit a parse tree produced by FlinkSqlParser#dropView.
FlinkSqlParserVisitor.prototype.visitDropView = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#dropFunction.
// Visit a parse tree produced by FlinkSqlParser#dropFunction.
FlinkSqlParserVisitor.prototype.visitDropFunction = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#insertStatement.
// Visit a parse tree produced by FlinkSqlParser#insertStatement.
FlinkSqlParserVisitor.prototype.visitInsertStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#insertPartitionDefinition.
// Visit a parse tree produced by FlinkSqlParser#insertPartitionDefinition.
FlinkSqlParserVisitor.prototype.visitInsertPartitionDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#valuesDefinition.
// Visit a parse tree produced by FlinkSqlParser#valuesDefinition.
FlinkSqlParserVisitor.prototype.visitValuesDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#valuesRowDefinition.
// Visit a parse tree produced by FlinkSqlParser#valuesRowDefinition.
FlinkSqlParserVisitor.prototype.visitValuesRowDefinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#allValueDifinition.
FlinkSqlParserVisitor.prototype.visitAllValueDifinition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#queryStatement.
// Visit a parse tree produced by FlinkSqlParser#queryStatement.
FlinkSqlParserVisitor.prototype.visitQueryStatement = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#selectStatement.
// 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 FlinkSqlParserParser#projectItemDefinition.
// 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 FlinkSqlParserParser#tableExpression.
// 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 FlinkSqlParserParser#tableReference.
// Visit a parse tree produced by FlinkSqlParser#tableReference.
FlinkSqlParserVisitor.prototype.visitTableReference = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#tablePrimary.
// Visit a parse tree produced by FlinkSqlParser#tablePrimary.
FlinkSqlParserVisitor.prototype.visitTablePrimary = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#expression.
// 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 FlinkSqlParserParser#logicalNot.
// Visit a parse tree produced by FlinkSqlParser#logicalNot.
FlinkSqlParserVisitor.prototype.visitLogicalNot = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#predicated.
// Visit a parse tree produced by FlinkSqlParser#predicated.
FlinkSqlParserVisitor.prototype.visitPredicated = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#logicalBinary.
// 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 FlinkSqlParserParser#predicate.
// Visit a parse tree produced by FlinkSqlParser#predicate.
FlinkSqlParserVisitor.prototype.visitPredicate = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#valueExpressionDefault.
// Visit a parse tree produced by FlinkSqlParser#valueExpressionDefault.
FlinkSqlParserVisitor.prototype.visitValueExpressionDefault = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#comparison.
// Visit a parse tree produced by FlinkSqlParser#comparison.
FlinkSqlParserVisitor.prototype.visitComparison = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#arithmeticBinary.
// Visit a parse tree produced by FlinkSqlParser#arithmeticBinary.
FlinkSqlParserVisitor.prototype.visitArithmeticBinary = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#arithmeticUnary.
// Visit a parse tree produced by FlinkSqlParser#arithmeticUnary.
FlinkSqlParserVisitor.prototype.visitArithmeticUnary = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#simpleCase.
// 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 FlinkSqlParserParser#constantDefault.
FlinkSqlParserVisitor.prototype.visitConstantDefault = function(ctx) {
// Visit a parse tree produced by FlinkSqlParser#columnReference.
FlinkSqlParserVisitor.prototype.visitColumnReference = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#parenthesizedExpression.
FlinkSqlParserVisitor.prototype.visitParenthesizedExpression = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#last.
// Visit a parse tree produced by FlinkSqlParser#last.
FlinkSqlParserVisitor.prototype.visitLast = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#star.
// Visit a parse tree produced by FlinkSqlParser#star.
FlinkSqlParserVisitor.prototype.visitStar = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#subscript.
// Visit a parse tree produced by FlinkSqlParser#subscript.
FlinkSqlParserVisitor.prototype.visitSubscript = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#searchedCase.
// Visit a parse tree produced by FlinkSqlParser#subqueryExpression.
FlinkSqlParserVisitor.prototype.visitSubqueryExpression = 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 FlinkSqlParserParser#position.
// Visit a parse tree produced by FlinkSqlParser#position.
FlinkSqlParserVisitor.prototype.visitPosition = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#first.
// Visit a parse tree produced by FlinkSqlParser#first.
FlinkSqlParserVisitor.prototype.visitFirst = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#tableAlias.
// 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#tableAlias.
FlinkSqlParserVisitor.prototype.visitTableAlias = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#identifierList.
// 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 FlinkSqlParserParser#identifierSeq.
// Visit a parse tree produced by FlinkSqlParser#identifierSeq.
FlinkSqlParserVisitor.prototype.visitIdentifierSeq = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#identifier.
// Visit a parse tree produced by FlinkSqlParser#identifier.
FlinkSqlParserVisitor.prototype.visitIdentifier = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#unquotedIdentifier.
FlinkSqlParserVisitor.prototype.visitUnquotedIdentifier = function(ctx) {
// Visit a parse tree produced by FlinkSqlParser#unquotedIdentifierAlternative.
FlinkSqlParserVisitor.prototype.visitUnquotedIdentifierAlternative = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#quotedIdentifierAlternative.
// Visit a parse tree produced by FlinkSqlParser#quotedIdentifierAlternative.
FlinkSqlParserVisitor.prototype.visitQuotedIdentifierAlternative = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#quotedIdentifier.
// 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 FlinkSqlParserParser#whenClause.
// Visit a parse tree produced by FlinkSqlParser#whenClause.
FlinkSqlParserVisitor.prototype.visitWhenClause = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#uidList.
// Visit a parse tree produced by FlinkSqlParser#uidList.
FlinkSqlParserVisitor.prototype.visitUidList = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#uid.
// Visit a parse tree produced by FlinkSqlParser#uid.
FlinkSqlParserVisitor.prototype.visitUid = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#withOption.
// Visit a parse tree produced by FlinkSqlParser#withOption.
FlinkSqlParserVisitor.prototype.visitWithOption = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#ifNotExists.
// Visit a parse tree produced by FlinkSqlParser#ifNotExists.
FlinkSqlParserVisitor.prototype.visitIfNotExists = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#ifExists.
// Visit a parse tree produced by FlinkSqlParser#ifExists.
FlinkSqlParserVisitor.prototype.visitIfExists = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#keyValueDefinition.
FlinkSqlParserVisitor.prototype.visitKeyValueDefinition = function(ctx) {
// Visit a parse tree produced by FlinkSqlParser#tablePropertyList.
FlinkSqlParserVisitor.prototype.visitTablePropertyList = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#logicalOperator.
// 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 FlinkSqlParserParser#comparisonOperator.
// Visit a parse tree produced by FlinkSqlParser#comparisonOperator.
FlinkSqlParserVisitor.prototype.visitComparisonOperator = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#bitOperator.
// Visit a parse tree produced by FlinkSqlParser#bitOperator.
FlinkSqlParserVisitor.prototype.visitBitOperator = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#mathOperator.
// Visit a parse tree produced by FlinkSqlParser#mathOperator.
FlinkSqlParserVisitor.prototype.visitMathOperator = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#unaryOperator.
// Visit a parse tree produced by FlinkSqlParser#unaryOperator.
FlinkSqlParserVisitor.prototype.visitUnaryOperator = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#fullColumnName.
// Visit a parse tree produced by FlinkSqlParser#fullColumnName.
FlinkSqlParserVisitor.prototype.visitFullColumnName = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#constant.
// Visit a parse tree produced by FlinkSqlParser#constant.
FlinkSqlParserVisitor.prototype.visitConstant = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#stringLiteral.
// Visit a parse tree produced by FlinkSqlParser#stringLiteral.
FlinkSqlParserVisitor.prototype.visitStringLiteral = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#decimalLiteral.
// Visit a parse tree produced by FlinkSqlParser#decimalLiteral.
FlinkSqlParserVisitor.prototype.visitDecimalLiteral = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#booleanLiteral.
// Visit a parse tree produced by FlinkSqlParser#booleanLiteral.
FlinkSqlParserVisitor.prototype.visitBooleanLiteral = function(ctx) {
return this.visitChildren(ctx);
};
// Visit a parse tree produced by FlinkSqlParserParser#setQuantifier.
// Visit a parse tree produced by FlinkSqlParser#setQuantifier.
FlinkSqlParserVisitor.prototype.visitSetQuantifier = function(ctx) {
return this.visitChildren(ctx);
};

View File

@ -8,7 +8,7 @@ import BasicParser from './common/BasicParser';
export default class FlinkSQL extends BasicParser {
public createLexer(input: string): Lexer {
const chars = new InputStream(input);
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;
}

View File

@ -1,5 +1,4 @@
import SQLParser from '../../../src/parser/flinksql';
// todo 校验 token 解析
describe('FlinkSQL Lexer tests', () => {
const parser = new SQLParser();
@ -7,6 +6,6 @@ describe('FlinkSQL Lexer tests', () => {
const tokens = parser.getAllTokens(sql);
test('token counts', () => {
expect(tokens.length).toBe(6);
expect(tokens.length).toBe(7);
});
});

View File

@ -15,8 +15,7 @@ describe('FlinkSQL Syntax Tests', () => {
`;
const result = parser.validate(sql);
console.log(result);
// TODO find parser error
expect(result.length).toBe(1);
expect(result.length).toBe(0);
});
test('Test simple CreateDatabase Statement', () => {
const sql = `
@ -28,14 +27,21 @@ describe('FlinkSQL Syntax Tests', () => {
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 ;
// `;
// 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', () => {
@ -44,7 +50,14 @@ describe('FlinkSQL Syntax Tests', () => {
expect(result.length).toBe(0);
});
test('Test simple AlterDatabase Statement', () => {
const sql = `ALTER DATABASE DataBase SET ("key1"="value1");`;
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);
});
@ -70,10 +83,93 @@ describe('FlinkSQL Syntax Tests', () => {
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);
console.log(result);
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);
});
});

View File

@ -1,23 +0,0 @@
import SQLParser, { PlSqlParserVisitor } from '../../../src/parser/plsql';
// todo 校验关键字提取
describe('PLSQL Visitor Tests', () => {
const expectTableName = 'user1';
const sql = `select id,name,sex from ${expectTableName};`;
const parser = new SQLParser();
const parserTree = parser.parse(sql);
test('Visitor visitTable_ref_list', () => {
let result = '';
class MyVisitor extends PlSqlParserVisitor {
visitTable_ref_list(ctx): void {
result = ctx.getText().toLowerCase();
super.visitTable_ref_list(ctx);
}
}
const visitor: any = new MyVisitor();
visitor.visit(parserTree);
expect(result).toBe(expectTableName);
});
});