Improve/flink keywords (#195)

* refactor: improve flinksql keywords rule

* test: correct flink sql unit test
This commit is contained in:
Hayden 2023-10-30 17:57:27 +08:00 committed by GitHub
parent 887de81521
commit 21dcb3fdce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 11685 additions and 9899 deletions

View File

@ -9,204 +9,42 @@ LINE_COMMENT: (
| '--' ('\r'? '\n' | EOF) | '--' ('\r'? '\n' | EOF)
) -> channel(HIDDEN); ) -> channel(HIDDEN);
// List of keywords that are not reserved. /**
// Please keep the keyword in alphabetical order if new keyword is added. * Keywords and Reserved Keywords
// Please add it to the nonReservedKeywords rule if new keyword is added. * Flink uses Calcite as its SQL parser,
// Reference link https://github.com/apache/flink/blob/release-1.16/flink-table/flink-sql-parser/src/main/codegen/data/Parser.tdd * The following keywords are derived from the Calcite documentation and Flink's own source code.
* First, perform a union between the keyword sets declared in the Flink source code and those in the Calcite documentation,
KW_ADD: 'ADD'; * then calculate the difference between the resulting set and the non-keyword set declared in the Flink source code.
KW_ADMIN: 'ADMIN'; *
KW_AFTER: 'AFTER'; * Calcite Documentation: https://calcite.apache.org/docs/reference.html#keywords
KW_ANALYZE: 'ANALYZE'; * Flink Parser.tdd file: https://github.com/apache/flink/blob/release-1.16/flink-table/flink-sql-parser/src/main/codegen/data/Parser.tdd
KW_ASC: 'ASC'; *
KW_BEFORE: 'BEFORE'; * Please keep the keyword in alphabetical order if new keyword is added.
KW_BYTES: 'BYTES'; * When adding new keywords, please consider whether they should be added to the NonReserved Keywords section below.
KW_CASCADE: 'CASCADE'; */
KW_CATALOG: 'CATALOG';
KW_CATALOGS: 'CATALOGS';
KW_CENTURY: 'CENTURY';
KW_CHAIN: 'CHAIN';
KW_CHANGELOG_MODE: 'CHANGELOG_MODE';
KW_CHARACTERS: 'CHARACTERS';
KW_COMMENT: 'COMMENT';
KW_COMPACT: 'COMPACT';
KW_COLUMNS: 'COLUMNS';
KW_CONSTRAINTS: 'CONSTRAINTS';
KW_CONSTRUCTOR: 'CONSTRUCTOR';
KW_CUMULATE: 'CUMULATE';
KW_DATA: 'DATA';
KW_DATABASE: 'DATABASE';
KW_DATABASES: 'DATABASES';
KW_DAYS: 'DAYS';
KW_DECADE: 'DECADE';
KW_DEFINED: 'DEFINED';
KW_DESC: 'DESC';
KW_DESCRIPTOR: 'DESCRIPTOR';
KW_DIV: 'DIV';
KW_ENCODING: 'ENCODING';
KW_ENFORCED: 'ENFORCED';
KW_ENGINE: 'ENGINE';
KW_EPOCH: 'EPOCH';
KW_ERROR: 'ERROR';
KW_ESTIMATED_COST: 'ESTIMATED_COST';
KW_EXCEPTION: 'EXCEPTION';
KW_EXCLUDE: 'EXCLUDE';
KW_EXCLUDING: 'EXCLUDING';
KW_EXTENDED: 'EXTENDED';
KW_FILE: 'FILE';
KW_FINAL: 'FINAL';
KW_FIRST: 'FIRST';
KW_FOLLOWING: 'FOLLOWING';
KW_FORMAT: 'FORMAT';
KW_FORTRAN: 'FORTRAN';
KW_FOUND: 'FOUND';
KW_FRAC_SECOND: 'FRAC_SECOND';
KW_FUNCTIONS: 'FUNCTIONS';
KW_GENERAL: 'GENERAL';
KW_GENERATED: 'GENERATED';
KW_GO: 'GO';
KW_GOTO: 'GOTO';
KW_GRANTED: 'GRANTED';
KW_HOP: 'HOP';
KW_HOURS: 'HOURS';
KW_IF: 'IF';
KW_IGNORE: 'IGNORE';
KW_INCREMENT: 'INCREMENT';
KW_INPUT: 'INPUT';
KW_INVOKER: 'INVOKER';
KW_JAR: 'JAR';
KW_JARS: 'JARS';
KW_JAVA: 'JAVA';
KW_JSON: 'JSON';
KW_JSON_EXECUTION_PLAN: 'JSON_EXECUTION_PLAN';
KW_KEY: 'KEY';
KW_KEY_MEMBER: 'KEY_MEMBER';
KW_KEY_TYPE: 'KEY_TYPE';
KW_LABEL: 'LABEL';
KW_LAST: 'LAST';
KW_LENGTH: 'LENGTH';
KW_LEVEL: 'LEVEL';
KW_LOAD: 'LOAD';
KW_MAP: 'MAP';
KW_MICROSECOND: 'MICROSECOND';
KW_MILLENNIUM: 'MILLENNIUM';
KW_MILLISECOND: 'MILLISECOND';
KW_MINUTES: 'MINUTES';
KW_MINVALUE: 'MINVALUE';
KW_MODIFY: 'MODIFY';
KW_MODULES: 'MODULES';
KW_MONTHS: 'MONTHS';
KW_NANOSECOND: 'NANOSECOND';
KW_NULLS: 'NULLS';
KW_NUMBER: 'NUMBER';
KW_OPTION: 'OPTION';
KW_OPTIONS: 'OPTIONS';
KW_ORDERING: 'ORDERING';
KW_OUTPUT: 'OUTPUT';
KW_OVERWRITE: 'OVERWRITE';
KW_OVERWRITING: 'OVERWRITING';
KW_PARTITIONED: 'PARTITIONED';
KW_PARTITIONS: 'PARTITIONS';
KW_PASSING: 'PASSING';
KW_PAST: 'PAST';
KW_PATH: 'PATH';
KW_PLACING: 'PLACING';
KW_PLAN: 'PLAN';
KW_PRECEDING: 'PRECEDING';
KW_PRESERVE: 'PRESERVE';
KW_PRIOR: 'PRIOR';
KW_PRIVILEGES: 'PRIVILEGES';
KW_PUBLIC: 'PUBLIC';
KW_PYTHON: 'PYTHON';
KW_PYTHON_FILES: 'PYTHON_FILES';
KW_PYTHON_REQUIREMENTS: 'PYTHON_REQUIREMENTS';
KW_PYTHON_DEPENDENCIES: 'PYTHON_DEPENDENCIES';
KW_PYTHON_JAR: 'PYTHON_JAR';
KW_PYTHON_ARCHIVES: 'PYTHON_ARCHIVES';
KW_PYTHON_PARAMETER: 'PYTHON_PARAMETER';
KW_QUARTER: 'QUARTER';
KW_RAW: 'RAW';
KW_READ: 'READ';
KW_RELATIVE: 'RELATIVE';
KW_REMOVE: 'REMOVE';
KW_RENAME: 'RENAME';
KW_REPLACE: 'REPLACE';
KW_RESPECT: 'RESPECT';
KW_RESTART: 'RESTART';
KW_RESTRICT: 'RESTRICT';
KW_ROLE: 'ROLE';
KW_ROW_COUNT: 'ROW_COUNT';
KW_SCALA: 'SCALA';
KW_SCALAR: 'SCALAR';
KW_SCALE: 'SCALE';
KW_SCHEMA: 'SCHEMA';
KW_SECONDS: 'SECONDS';
KW_SECTION: 'SECTION';
KW_SECURITY: 'SECURITY';
KW_SELF: 'SELF';
KW_SERVER: 'SERVER';
KW_SERVER_NAME: 'SERVER_NAME';
KW_SESSION: 'SESSION';
KW_SETS: 'SETS';
KW_SIMPLE: 'SIMPLE';
KW_SIZE: 'SIZE';
KW_SLIDE: 'SLIDE';
KW_SOURCE: 'SOURCE';
KW_SPACE: 'SPACE';
KW_STATE: 'STATE';
KW_STATEMENT: 'STATEMENT';
KW_STEP: 'STEP';
KW_STRING: 'STRING';
KW_STRUCTURE: 'STRUCTURE';
KW_STYLE: 'STYLE';
KW_TABLES: 'TABLES';
KW_TEMPORARY: 'TEMPORARY';
KW_TIMECOL: 'TIMECOL';
KW_TIMESTAMP_LTZ: 'TIMESTAMP_LTZ';
KW_TIMESTAMPADD: 'TIMESTAMPADD';
KW_TIMESTAMPDIFF: 'TIMESTAMPDIFF';
KW_TRANSFORM: 'TRANSFORM';
KW_TUMBLE: 'TUMBLE';
KW_TYPE: 'TYPE';
KW_UNDER: 'UNDER';
KW_UNLOAD: 'UNLOAD';
KW_USAGE: 'USAGE';
KW_USE: 'USE';
KW_UTF16: 'UTF16';
KW_UTF32: 'UTF32';
KW_UTF8: 'UTF8';
KW_VERSION: 'VERSION';
KW_VIEW: 'VIEW';
KW_VIEWS: 'VIEWS';
KW_VIRTUAL: 'VIRTUAL';
KW_WATERMARK: 'WATERMARK';
KW_WATERMARKS: 'WATERMARKS';
KW_WEEK: 'WEEK';
KW_WEEKS: 'WEEKS';
KW_WORK: 'WORK';
KW_WRAPPER: 'WRAPPER';
KW_YEARS: 'YEARS';
KW_ZONE: 'ZONE';
// Reserved Keywords
// Please keep the keyword in alphabetical order if new keyword is added.
// Please add it to the reservedKeywords rule if new keyword is added.
// Reference link https://calcite.apache.org/docs/reference.html
KW_ABS: 'ABS'; KW_ABS: 'ABS';
KW_ALL: 'ALL'; KW_ALL: 'ALL';
KW_ALLOCATE: 'ALLOCATE';
KW_ALLOW: 'ALLOW'; KW_ALLOW: 'ALLOW';
KW_ALTER : 'ALTER'; KW_ALTER: 'ALTER';
KW_ANALYZE: 'ANALYZE';
KW_AND: 'AND'; KW_AND: 'AND';
KW_ANY: 'ANY'; KW_ANY: 'ANY';
KW_ARE: 'ARE'; KW_ARE: 'ARE';
KW_ARRAY: 'ARRAY'; KW_ARRAY: 'ARRAY';
KW_ARRAY_AGG: 'ARRAY_AGG';
KW_ARRAY_CONCAT_AGG: 'ARRAY_CONCAT_AGG';
KW_ARRAY_MAX_CARDINALITY: 'ARRAY_MAX_CARDINALITY';
KW_AS: 'AS'; KW_AS: 'AS';
KW_ASENSITIVE: 'ASENSITIVE';
KW_ASYMMETRIC: 'ASYMMETRIC'; KW_ASYMMETRIC: 'ASYMMETRIC';
KW_AT: 'AT'; KW_AT: 'AT';
KW_ATOMIC: 'ATOMIC';
KW_AUTHORIZATION: 'AUTHORIZATION';
KW_AVG: 'AVG'; KW_AVG: 'AVG';
KW_BEGIN: 'BEGIN'; KW_BEGIN: 'BEGIN';
KW_BEGIN_FRAME: 'BEGIN_FRAME';
KW_BEGIN_PARTITION: 'BEGIN_PARTITION';
KW_BETWEEN: 'BETWEEN'; KW_BETWEEN: 'BETWEEN';
KW_BIGINT: 'BIGINT'; KW_BIGINT: 'BIGINT';
KW_BINARY: 'BINARY'; KW_BINARY: 'BINARY';
@ -215,131 +53,288 @@ KW_BLOB: 'BLOB';
KW_BOOLEAN: 'BOOLEAN'; KW_BOOLEAN: 'BOOLEAN';
KW_BOTH: 'BOTH'; KW_BOTH: 'BOTH';
KW_BY: 'BY'; KW_BY: 'BY';
KW_BYTES: 'BYTES';
KW_CALL: 'CALL'; KW_CALL: 'CALL';
KW_CALLED: 'CALLED'; KW_CALLED: 'CALLED';
KW_CARDINALITY: 'CARDINALITY';
KW_CASCADED: 'CASCADED'; KW_CASCADED: 'CASCADED';
KW_CASE: 'CASE'; KW_CASE: 'CASE';
KW_CAST: 'CAST'; KW_CAST: 'CAST';
KW_CATALOGS: 'CATALOGS';
KW_CEIL: 'CEIL'; KW_CEIL: 'CEIL';
KW_CEILING: 'CEILING';
KW_CHANGELOG_MODE: 'CHANGELOG_MODE';
KW_CHAR: 'CHAR'; KW_CHAR: 'CHAR';
KW_CHARACTER: 'CHARACTER'; KW_CHARACTER: 'CHARACTER';
KW_CHARACTER_LENGTH: 'CHARACTER_LENGTH';
KW_CHAR_LENGTH: 'CHAR_LENGTH';
KW_CHECK: 'CHECK'; KW_CHECK: 'CHECK';
KW_CLASSIFIER: 'CLASSIFIER';
KW_CLOB: 'CLOB'; KW_CLOB: 'CLOB';
KW_CLOSE: 'CLOSE'; KW_CLOSE: 'CLOSE';
KW_COALESCE: 'COALESCE'; KW_COALESCE: 'COALESCE';
KW_CONFIG: 'CONFIG';
KW_COLLATE: 'COLLATE'; KW_COLLATE: 'COLLATE';
KW_COLLECT: 'COLLECT'; KW_COLLECT: 'COLLECT';
KW_COLUMN: 'COLUMN'; KW_COLUMN: 'COLUMN';
KW_COLUMNS: 'COLUMNS';
KW_COMMENT: 'COMMENT';
KW_COMMIT: 'COMMIT'; KW_COMMIT: 'COMMIT';
KW_COMPUTE: 'COMPUTE';
KW_CONDITION: 'CONDITION';
KW_CONNECT: 'CONNECT'; KW_CONNECT: 'CONNECT';
KW_CONSTRAINT: 'CONSTRAINT'; KW_CONSTRAINT: 'CONSTRAINT';
KW_CONTAINS: 'CONTAINS'; KW_CONTAINS: 'CONTAINS';
KW_CONVERT: 'CONVERT'; KW_CONVERT: 'CONVERT';
KW_CORR: 'CORR';
KW_CORRESPONDING: 'CORRESPONDING';
KW_COUNT: 'COUNT'; KW_COUNT: 'COUNT';
KW_COVAR_POP: 'COVAR_POP';
KW_COVAR_SAMP: 'COVAR_SAMP';
KW_CREATE: 'CREATE'; KW_CREATE: 'CREATE';
KW_CROSS: 'CROSS'; KW_CROSS: 'CROSS';
KW_CUBE: 'CUBE'; KW_CUBE: 'CUBE';
KW_CUME_DIST: 'CUME_DIST';
KW_CURRENT: 'CURRENT'; KW_CURRENT: 'CURRENT';
KW_CURRENT_CATALOG: 'CURRENT_CATALOG';
KW_CURRENT_DATE: 'CURRENT_DATE';
KW_CURRENT_DEFAULT_TRANSFORM_GROUP: 'CURRENT_DEFAULT_TRANSFORM_GROUP';
KW_CURRENT_PATH: 'CURRENT_PATH';
KW_CURRENT_ROLE: 'CURRENT_ROLE';
KW_CURRENT_ROW: 'CURRENT_ROW';
KW_CURRENT_SCHEMA: 'CURRENT_SCHEMA';
KW_CURRENT_TIME: 'CURRENT_TIME';
KW_CURRENT_TIMESTAMP: 'CURRENT_TIMESTAMP';
KW_CURRENT_TRANSFORM_GROUP_FOR_TYPE: 'CURRENT_TRANSFORM_GROUP_FOR_TYPE';
KW_CURRENT_USER: 'CURRENT_USER';
KW_CURSOR: 'CURSOR'; KW_CURSOR: 'CURSOR';
KW_CYCLE: 'CYCLE'; KW_CYCLE: 'CYCLE';
KW_DATABASES: 'DATABASES';
KW_DATE: 'DATE'; KW_DATE: 'DATE';
KW_DATETIME: 'DATETIME'; KW_DATETIME: 'DATETIME';
KW_DATETIME_DIFF: 'DATETIME_DIFF';
KW_DATETIME_TRUNC: 'DATETIME_TRUNC';
KW_DATE_DIFF: 'DATE_DIFF';
KW_DATE_TRUNC: 'DATE_TRUNC';
KW_DAY: 'DAY'; KW_DAY: 'DAY';
KW_DAYOFWEEK: 'DAYOFWEEK';
KW_DAYOFYEAR: 'DAYOFYEAR';
KW_DEALLOCATE: 'DEALLOCATE';
KW_DEC: 'DEC'; KW_DEC: 'DEC';
KW_DECIMAL: 'DECIMAL'; KW_DECIMAL: 'DECIMAL';
KW_DECLARE: 'DECLARE'; KW_DECLARE: 'DECLARE';
KW_DEFAULT: 'DEFAULT'; KW_DEFAULT: 'DEFAULT';
KW_DEFINE: 'DEFINE'; KW_DEFINE: 'DEFINE';
KW_DELETE: 'DELETE'; KW_DELETE: 'DELETE';
KW_DENSE_RANK: 'DENSE_RANK';
KW_DEREF: 'DEREF';
KW_DESCRIBE: 'DESCRIBE'; KW_DESCRIBE: 'DESCRIBE';
KW_DETERMINISTIC: 'DETERMINISTIC';
KW_DISALLOW: 'DISALLOW';
KW_DISCONNECT: 'DISCONNECT';
KW_DISTINCT: 'DISTINCT'; KW_DISTINCT: 'DISTINCT';
KW_DOT: 'DOT';
KW_DOUBLE: 'DOUBLE'; KW_DOUBLE: 'DOUBLE';
KW_DROP: 'DROP'; KW_DROP: 'DROP';
KW_DYNAMIC: 'DYNAMIC';
KW_EACH: 'EACH'; KW_EACH: 'EACH';
KW_ELEMENT: 'ELEMENT';
KW_ELSE: 'ELSE'; KW_ELSE: 'ELSE';
KW_EMPTY: 'EMPTY';
KW_END: 'END'; KW_END: 'END';
// KW_END_EXEC: 'END-EXEC';
KW_END_FRAME: 'END_FRAME';
KW_END_PARTITION: 'END_PARTITION';
KW_ENFORCED: 'ENFORCED';
KW_EQUALS: 'EQUALS'; KW_EQUALS: 'EQUALS';
KW_ESCAPE: 'ESCAPE'; KW_ESCAPE: 'ESCAPE';
KW_ESTIMATED_COST: 'ESTIMATED_COST';
KW_EVERY: 'EVERY';
KW_EXCEPT: 'EXCEPT'; KW_EXCEPT: 'EXCEPT';
KW_EXEC: 'EXEC';
KW_EXECUTE: 'EXECUTE'; KW_EXECUTE: 'EXECUTE';
KW_EXISTS: 'EXISTS'; KW_EXISTS: 'EXISTS';
KW_EXP: 'EXP';
KW_EXPLAIN: 'EXPLAIN'; KW_EXPLAIN: 'EXPLAIN';
KW_EXTEND: 'EXTEND';
KW_EXTENDED: 'EXTENDED';
KW_EXTERNAL: 'EXTERNAL'; KW_EXTERNAL: 'EXTERNAL';
KW_EXTRACT: 'EXTRACT'; KW_EXTRACT: 'EXTRACT';
KW_FALSE: 'FALSE'; KW_FALSE: 'FALSE';
KW_FETCH: 'FETCH';
KW_FILTER: 'FILTER';
KW_FIRST_VALUE: 'FIRST_VALUE';
KW_FLOAT: 'FLOAT'; KW_FLOAT: 'FLOAT';
KW_FLOOR: 'FLOOR';
KW_FOR: 'FOR'; KW_FOR: 'FOR';
KW_FOREIGN: 'FOREIGN';
KW_FRAME_ROW: 'FRAME_ROW';
KW_FREE: 'FREE';
KW_FRIDAY: 'FRIDAY';
KW_FROM: 'FROM'; KW_FROM: 'FROM';
KW_FULL: 'FULL'; KW_FULL: 'FULL';
KW_FUNCTION: 'FUNCTION'; KW_FUNCTION: 'FUNCTION';
KW_FUNCTIONS: 'FUNCTIONS';
KW_FUSION: 'FUSION';
KW_GET: 'GET';
KW_GLOBAL: 'GLOBAL'; KW_GLOBAL: 'GLOBAL';
KW_GRANT: 'GRANT'; KW_GRANT: 'GRANT';
KW_GROUP: 'GROUP'; KW_GROUP: 'GROUP';
KW_GROUPING: 'GROUPING'; KW_GROUPING: 'GROUPING';
KW_GROUPS: 'GROUPS'; KW_GROUPS: 'GROUPS';
KW_GROUP_CONCAT: 'GROUP_CONCAT';
KW_HAVING: 'HAVING'; KW_HAVING: 'HAVING';
KW_HOLD: 'HOLD';
KW_HOUR: 'HOUR'; KW_HOUR: 'HOUR';
KW_IDENTITY: 'IDENTITY';
KW_IF: 'IF';
KW_ILIKE: 'ILIKE';
KW_IMPORT: 'IMPORT'; KW_IMPORT: 'IMPORT';
KW_IN: 'IN'; KW_IN: 'IN';
KW_INCLUDING: 'INCLUDING'; KW_INCLUDE: 'INCLUDE';
KW_INDICATOR: 'INDICATOR';
KW_INITIAL: 'INITIAL';
KW_INNER: 'INNER'; KW_INNER: 'INNER';
KW_INOUT: 'INOUT'; KW_INOUT: 'INOUT';
KW_INSENSITIVE: 'INSENSITIVE';
KW_INSERT: 'INSERT'; KW_INSERT: 'INSERT';
KW_INT: 'INT'; KW_INT: 'INT';
KW_INTEGER: 'INTEGER'; KW_INTEGER: 'INTEGER';
KW_INTERSECT: 'INTERSECT'; KW_INTERSECT: 'INTERSECT';
KW_INTERSECTION: 'INTERSECTION';
KW_INTERVAL: 'INTERVAL'; KW_INTERVAL: 'INTERVAL';
KW_INTO: 'INTO'; KW_INTO: 'INTO';
KW_IS: 'IS'; KW_IS: 'IS';
KW_JOIN: 'JOIN'; KW_JOIN: 'JOIN';
KW_JSON_ARRAY: 'JSON_ARRAY';
KW_JSON_ARRAYAGG: 'JSON_ARRAYAGG';
KW_JSON_EXECUTION_PLAN: 'JSON_EXECUTION_PLAN';
KW_JSON_EXISTS: 'JSON_EXISTS';
KW_JSON_OBJECT: 'JSON_OBJECT';
KW_JSON_OBJECTAGG: 'JSON_OBJECTAGG';
KW_JSON_QUERY: 'JSON_QUERY';
KW_JSON_VALUE: 'JSON_VALUE';
KW_LAG: 'LAG'; KW_LAG: 'LAG';
KW_LANGUAGE: 'LANGUAGE'; KW_LANGUAGE: 'LANGUAGE';
KW_LARGE: 'LARGE';
KW_LAST_VALUE: 'LAST_VALUE';
KW_LATERAL: 'LATERAL'; KW_LATERAL: 'LATERAL';
KW_LEAD: 'LEAD';
KW_LEADING: 'LEADING'; KW_LEADING: 'LEADING';
KW_LEFT: 'LEFT'; KW_LEFT: 'LEFT';
KW_LIKE: 'LIKE'; KW_LIKE: 'LIKE';
KW_LIKE_REGEX: 'LIKE_REGEX';
KW_LIMIT: 'LIMIT'; KW_LIMIT: 'LIMIT';
KW_LN: 'LN';
KW_LOCAL: 'LOCAL'; KW_LOCAL: 'LOCAL';
KW_LOCALTIME: 'LOCALTIME';
KW_LOCALTIMESTAMP: 'LOCALTIMESTAMP';
KW_LOWER: 'LOWER';
KW_MATCH: 'MATCH'; KW_MATCH: 'MATCH';
KW_MATCHES: 'MATCHES';
KW_MATCH_NUMBER: 'MATCH_NUMBER';
KW_MATCH_RECOGNIZE: 'MATCH_RECOGNIZE'; KW_MATCH_RECOGNIZE: 'MATCH_RECOGNIZE';
KW_MAX: 'MAX';
KW_MEASURES: 'MEASURES'; KW_MEASURES: 'MEASURES';
KW_MEMBER: 'MEMBER';
KW_MERGE: 'MERGE'; KW_MERGE: 'MERGE';
KW_METADATA: 'METADATA'; KW_METADATA: 'METADATA';
KW_METHOD: 'METHOD';
KW_MIN: 'MIN';
KW_MINUS: 'MINUS'; KW_MINUS: 'MINUS';
KW_MINUTE: 'MINUTE'; KW_MINUTE: 'MINUTE';
KW_MOD: 'MOD';
KW_MODIFIES: 'MODIFIES'; KW_MODIFIES: 'MODIFIES';
KW_MODIFY: 'MODIFY';
KW_MODULE: 'MODULE'; KW_MODULE: 'MODULE';
KW_MODULES: 'MODULES';
KW_MONDAY: 'MONDAY';
KW_MONTH: 'MONTH'; KW_MONTH: 'MONTH';
KW_MORE: 'MORE';
KW_MULTISET: 'MULTISET'; KW_MULTISET: 'MULTISET';
KW_NATIONAL: 'NATIONAL';
KW_NATURAL: 'NATURAL'; KW_NATURAL: 'NATURAL';
KW_NCHAR: 'NCHAR';
KW_NCLOB: 'NCLOB';
KW_NEW: 'NEW';
KW_NEXT: 'NEXT'; KW_NEXT: 'NEXT';
KW_NO: 'NO'; KW_NO: 'NO';
KW_NONE: 'NONE'; KW_NONE: 'NONE';
KW_NORMALIZE: 'NORMALIZE';
KW_NOT: 'NOT'; KW_NOT: 'NOT';
KW_NTH_VALUE: 'NTH_VALUE';
KW_NTILE: 'NTILE';
KW_NULL: 'NULL'; KW_NULL: 'NULL';
KW_NULLIF: 'NULLIF';
KW_NUMERIC: 'NUMERIC'; KW_NUMERIC: 'NUMERIC';
KW_OCCURRENCES_REGEX: 'OCCURRENCES_REGEX';
KW_OCTET_LENGTH: 'OCTET_LENGTH';
KW_OF: 'OF'; KW_OF: 'OF';
KW_OFFSET: 'OFFSET'; KW_OFFSET: 'OFFSET';
KW_OLD: 'OLD';
KW_OMIT: 'OMIT';
KW_ON: 'ON'; KW_ON: 'ON';
KW_ONE: 'ONE'; KW_ONE: 'ONE';
KW_ONLY: 'ONLY';
KW_OPEN: 'OPEN';
KW_OR: 'OR'; KW_OR: 'OR';
KW_ORDER: 'ORDER'; KW_ORDER: 'ORDER';
KW_ORDINAL: 'ORDINAL';
KW_OUT: 'OUT'; KW_OUT: 'OUT';
KW_OUTER: 'OUTER'; KW_OUTER: 'OUTER';
KW_OVER: 'OVER'; KW_OVER: 'OVER';
KW_OVERLAPS: 'OVERLAPS';
KW_OVERLAY: 'OVERLAY'; KW_OVERLAY: 'OVERLAY';
KW_OVERWRITE: 'OVERWRITE';
KW_OVERWRITING: 'OVERWRITING';
KW_PARAMETER: 'PARAMETER';
KW_PARTITION: 'PARTITION'; KW_PARTITION: 'PARTITION';
KW_PARTITIONED: 'PARTITIONED';
KW_PARTITIONS: 'PARTITIONS';
KW_PATTERN: 'PATTERN'; KW_PATTERN: 'PATTERN';
KW_PER: 'PER'; KW_PER: 'PER';
KW_PERCENT: 'PERCENT'; KW_PERCENT: 'PERCENT';
KW_PERCENTILE_CONT: 'PERCENTILE_CONT';
KW_PERCENTILE_DISC: 'PERCENTILE_DISC';
KW_PERCENT_RANK: 'PERCENT_RANK';
KW_PERIOD: 'PERIOD'; KW_PERIOD: 'PERIOD';
KW_PERMUTE: 'PERMUTE';
KW_PIVOT: 'PIVOT';
KW_PORTION: 'PORTION';
KW_POSITION: 'POSITION'; KW_POSITION: 'POSITION';
KW_POSITION_REGEX: 'POSITION_REGEX';
KW_POWER: 'POWER'; KW_POWER: 'POWER';
KW_PRECEDES: 'PRECEDES';
KW_PRECISION: 'PRECISION';
KW_PREPARE: 'PREPARE';
KW_PREV: 'PREV';
KW_PRIMARY: 'PRIMARY'; KW_PRIMARY: 'PRIMARY';
KW_PROCEDURE: 'PROCEDURE';
KW_QUALIFY: 'QUALIFY';
KW_QUARTERS: 'QUARTERS';
KW_RANGE: 'RANGE'; KW_RANGE: 'RANGE';
KW_RANK: 'RANK'; KW_RANK: 'RANK';
KW_RAW: 'RAW';
KW_READS: 'READS';
KW_REAL: 'REAL';
KW_RECURSIVE: 'RECURSIVE';
KW_REF: 'REF';
KW_REFERENCES: 'REFERENCES';
KW_REFERENCING: 'REFERENCING';
KW_REGR_AVGX: 'REGR_AVGX';
KW_REGR_AVGY: 'REGR_AVGY';
KW_REGR_COUNT: 'REGR_COUNT';
KW_REGR_INTERCEPT: 'REGR_INTERCEPT';
KW_REGR_R2: 'REGR_R2';
KW_REGR_SLOPE: 'REGR_SLOPE';
KW_REGR_SXX: 'REGR_SXX';
KW_REGR_SXY: 'REGR_SXY';
KW_REGR_SYY: 'REGR_SYY';
KW_RELEASE: 'RELEASE';
KW_RENAME: 'RENAME';
KW_RESET: 'RESET'; KW_RESET: 'RESET';
KW_RESULT: 'RESULT';
KW_RETURN: 'RETURN';
KW_RETURNS: 'RETURNS';
KW_REVOKE: 'REVOKE'; KW_REVOKE: 'REVOKE';
KW_RIGHT: 'RIGHT'; KW_RIGHT: 'RIGHT';
KW_RLIKE: 'RLIKE'; KW_RLIKE: 'RLIKE';
@ -347,51 +342,196 @@ KW_ROLLBACK: 'ROLLBACK';
KW_ROLLUP: 'ROLLUP'; KW_ROLLUP: 'ROLLUP';
KW_ROW: 'ROW'; KW_ROW: 'ROW';
KW_ROWS: 'ROWS'; KW_ROWS: 'ROWS';
KW_ROW_NUMBER: 'ROW_NUMBER';
KW_RUNNING: 'RUNNING';
KW_SAFE_CAST: 'SAFE_CAST';
KW_SAFE_OFFSET: 'SAFE_OFFSET';
KW_SAFE_ORDINAL: 'SAFE_ORDINAL';
KW_SATURDAY: 'SATURDAY';
KW_SAVEPOINT: 'SAVEPOINT';
KW_SCALA: 'SCALA';
KW_SCOPE: 'SCOPE';
KW_SCROLL: 'SCROLL';
KW_SEARCH: 'SEARCH';
KW_SECOND: 'SECOND'; KW_SECOND: 'SECOND';
KW_SEEK: 'SEEK';
KW_SELECT: 'SELECT'; KW_SELECT: 'SELECT';
KW_SENSITIVE: 'SENSITIVE';
KW_SEPARATOR: 'SEPARATOR';
KW_SESSION_USER: 'SESSION_USER';
KW_SET: 'SET'; KW_SET: 'SET';
KW_SHOW: 'SHOW'; KW_SHOW: 'SHOW';
KW_SIMILAR: 'SIMILAR'; KW_SIMILAR: 'SIMILAR';
KW_SKIP: 'SKIP'; KW_SKIP: 'SKIP';
KW_SMALLINT: 'SMALLINT'; KW_SMALLINT: 'SMALLINT';
KW_SOME: 'SOME';
KW_SPECIFIC: 'SPECIFIC';
KW_SPECIFICTYPE: 'SPECIFICTYPE';
KW_SQL: 'SQL';
KW_SQLEXCEPTION: 'SQLEXCEPTION';
KW_SQLSTATE: 'SQLSTATE';
KW_SQLWARNING: 'SQLWARNING';
KW_SQRT: 'SQRT';
KW_START: 'START'; KW_START: 'START';
KW_STATEMENT: 'STATEMENT';
KW_STATIC: 'STATIC'; KW_STATIC: 'STATIC';
KW_STATISTICS: 'STATISTICS';
KW_STDDEV_POP: 'STDDEV_POP';
KW_STDDEV_SAMP: 'STDDEV_SAMP';
KW_STREAM: 'STREAM';
KW_STRING: 'STRING';
KW_STRING_AGG: 'STRING_AGG';
KW_SUBMULTISET: 'SUBMULTISET';
KW_SUBSET: 'SUBSET';
KW_SUBSTRING: 'SUBSTRING'; KW_SUBSTRING: 'SUBSTRING';
KW_SUBSTRING_REGEX: 'SUBSTRING_REGEX';
KW_SUCCEEDS: 'SUCCEEDS';
KW_SUM: 'SUM'; KW_SUM: 'SUM';
KW_SUNDAY: 'SUNDAY';
KW_SYMMETRIC: 'SYMMETRIC'; KW_SYMMETRIC: 'SYMMETRIC';
KW_SYSTEM: 'SYSTEM'; KW_SYSTEM: 'SYSTEM';
KW_SYSTEM_TIME: 'SYSTEM_TIME'; KW_SYSTEM_TIME: 'SYSTEM_TIME';
KW_SYSTEM_USER: 'SYSTEM_USER'; KW_SYSTEM_USER: 'SYSTEM_USER';
KW_TABLE: 'TABLE'; KW_TABLE: 'TABLE';
KW_TABLES: 'TABLES';
KW_TABLESAMPLE: 'TABLESAMPLE'; KW_TABLESAMPLE: 'TABLESAMPLE';
KW_THEN: 'THEN'; KW_THEN: 'THEN';
KW_THURSDAY: 'THURSDAY';
KW_TIME: 'TIME'; KW_TIME: 'TIME';
KW_TIMESTAMP: 'TIMESTAMP'; KW_TIMESTAMP: 'TIMESTAMP';
KW_TIMESTAMP_DIFF: 'TIMESTAMP_DIFF';
KW_TIMESTAMP_LTZ: 'TIMESTAMP_LTZ';
KW_TIMESTAMP_TRUNC: 'TIMESTAMP_TRUNC';
KW_TIMEZONE_HOUR: 'TIMEZONE_HOUR';
KW_TIMEZONE_MINUTE: 'TIMEZONE_MINUTE';
KW_TIME_DIFF: 'TIME_DIFF';
KW_TIME_TRUNC: 'TIME_TRUNC';
KW_TINYINT: 'TINYINT'; KW_TINYINT: 'TINYINT';
KW_TO: 'TO'; KW_TO: 'TO';
KW_TRAILING: 'TRAILING'; KW_TRAILING: 'TRAILING';
KW_TRANSLATE: 'TRANSLATE';
KW_TRANSLATE_REGEX: 'TRANSLATE_REGEX';
KW_TRANSLATION: 'TRANSLATION';
KW_TREAT: 'TREAT';
KW_TRIGGER: 'TRIGGER';
KW_TRIM: 'TRIM';
KW_TRIM_ARRAY: 'TRIM_ARRAY';
KW_TRUE: 'TRUE'; KW_TRUE: 'TRUE';
KW_TRUNCATE: 'TRUNCATE'; KW_TRUNCATE: 'TRUNCATE';
KW_TRY_CAST: 'TRY_CAST';
KW_TUESDAY: 'TUESDAY';
KW_UESCAPE: 'UESCAPE';
KW_UNION: 'UNION'; KW_UNION: 'UNION';
KW_UNIQUE: 'UNIQUE'; KW_UNIQUE: 'UNIQUE';
KW_UNKNOWN: 'UNKNOWN'; KW_UNKNOWN: 'UNKNOWN';
KW_UNNEST: 'UNNEST'; KW_UNNEST: 'UNNEST';
KW_UNPIVOT: 'UNPIVOT';
KW_UPDATE: 'UPDATE';
KW_UPPER: 'UPPER'; KW_UPPER: 'UPPER';
KW_UPSERT: 'UPSERT'; KW_UPSERT: 'UPSERT';
KW_USE: 'USE';
KW_USER: 'USER'; KW_USER: 'USER';
KW_USING: 'USING'; KW_USING: 'USING';
KW_VALUE: 'VALUE'; KW_VALUE: 'VALUE';
KW_VALUES: 'VALUES'; KW_VALUES: 'VALUES';
KW_VALUE_OF: 'VALUE_OF';
KW_VARBINARY: 'VARBINARY'; KW_VARBINARY: 'VARBINARY';
KW_VARCHAR: 'VARCHAR'; KW_VARCHAR: 'VARCHAR';
KW_VARYING: 'VARYING';
KW_VAR_POP: 'VAR_POP';
KW_VAR_SAMP: 'VAR_SAMP';
KW_VERSIONING: 'VERSIONING';
KW_VIEWS: 'VIEWS';
KW_VIRTUAL: 'VIRTUAL';
KW_WATERMARK: 'WATERMARK';
KW_WATERMARKS: 'WATERMARKS';
KW_WEDNESDAY: 'WEDNESDAY';
KW_WEEKS: 'WEEKS';
KW_WHEN: 'WHEN'; KW_WHEN: 'WHEN';
KW_WHENEVER: 'WHENEVER';
KW_WHERE: 'WHERE'; KW_WHERE: 'WHERE';
KW_WIDTH_BUCKET: 'WIDTH_BUCKET';
KW_WINDOW: 'WINDOW'; KW_WINDOW: 'WINDOW';
KW_WITH: 'WITH'; KW_WITH: 'WITH';
KW_WITHIN: 'WITHIN'; KW_WITHIN: 'WITHIN';
KW_WITHOUT: 'WITHOUT'; KW_WITHOUT: 'WITHOUT';
KW_YEAR: 'YEAR'; KW_YEAR: 'YEAR';
/**
* Non-Reserved Keywords
* Keywords that are used in the syntax rules but do not exist in the above keyword list section.
* Please keep the keyword in alphabetical order if new keyword is added.
* New non-reserved keywords should also be added to the nonReservedKeywords rule in FlinkSqlParser.g4 file.
*/
KW_ADD :'ADD';
KW_AFTER :'AFTER';
KW_ASC :'ASC';
KW_CASCADE :'CASCADE';
KW_CATALOG :'CATALOG';
KW_CENTURY :'CENTURY';
KW_CONFIG :'CONFIG';
KW_CONSTRAINTS :'CONSTRAINTS';
KW_CUMULATE :'CUMULATE';
KW_DATA :'DATA';
KW_DATABASE :'DATABASE';
KW_DAYS :'DAYS';
KW_DECADE :'DECADE';
KW_DESC :'DESC';
KW_DESCRIPTOR :'DESCRIPTOR';
KW_DIV :'DIV';
KW_ENGINE :'ENGINE';
KW_EPOCH :'EPOCH';
KW_EXCLUDING :'EXCLUDING';
KW_FILE :'FILE';
KW_FIRST :'FIRST';
KW_GENERATED :'GENERATED';
KW_HOP :'HOP';
KW_HOURS :'HOURS';
KW_IGNORE :'IGNORE';
KW_INCLUDING :'INCLUDING';
KW_JAR :'JAR';
KW_JARS :'JARS';
KW_JAVA :'JAVA';
KW_KEY :'KEY';
KW_LAST :'LAST';
KW_LOAD :'LOAD';
KW_MAP :'MAP';
KW_MICROSECOND :'MICROSECOND';
KW_MILLENNIUM :'MILLENNIUM';
KW_MILLISECOND :'MILLISECOND';
KW_MINUTES :'MINUTES';
KW_MONTHS :'MONTHS';
KW_NANOSECOND :'NANOSECOND';
KW_NULLS :'NULLS';
KW_OPTIONS :'OPTIONS';
KW_PAST :'PAST';
KW_PLAN :'PLAN';
KW_PRECEDING :'PRECEDING';
KW_PYTHON :'PYTHON';
KW_PYTHON_ARCHIVES :'PYTHON_ARCHIVES';
KW_PYTHON_DEPENDENCIES :'PYTHON_DEPENDENCIES';
KW_PYTHON_FILES :'PYTHON_FILES';
KW_PYTHON_JAR :'PYTHON_JAR';
KW_PYTHON_PARAMETER :'PYTHON_PARAMETER';
KW_PYTHON_REQUIREMENTS :'PYTHON_REQUIREMENTS';
KW_QUARTER :'QUARTER';
KW_REMOVE :'REMOVE';
KW_RESTRICT :'RESTRICT';
KW_SECONDS :'SECONDS';
KW_SESSION :'SESSION';
KW_SETS :'SETS';
KW_SIZE :'SIZE';
KW_SLIDE :'SLIDE';
KW_STEP :'STEP';
KW_TEMPORARY :'TEMPORARY';
KW_TIMECOL :'TIMECOL';
KW_TUMBLE :'TUMBLE';
KW_UNLOAD :'UNLOAD';
KW_VIEW :'VIEW';
KW_WEEK :'WEEK';
KW_YEARS :'YEARS';
KW_ZONE :'ZONE';
// Operators. Comparation // Operators. Comparation

View File

@ -414,7 +414,7 @@ withItemName
; ;
selectStatement selectStatement
: selectClause fromClause whereClause? groupByClause? havingClause? windowClause? : selectClause fromClause? whereClause? groupByClause? havingClause? windowClause?
| selectClause fromClause matchRecognizeClause | selectClause fromClause matchRecognizeClause
; ;
@ -721,6 +721,7 @@ primaryExpression
| identifier #columnReference | identifier #columnReference
| dereferenceDefinition #dereference | dereferenceDefinition #dereference
| LR_BRACKET expression RR_BRACKET #parenthesizedExpression | LR_BRACKET expression RR_BRACKET #parenthesizedExpression
| KW_CURRENT_TIMESTAMP #dateFunctionExpression
// | EXTRACT LR_BRACKET field=identifier KW_FROM source=valueExpression RR_BRACKET #extract // | EXTRACT LR_BRACKET field=identifier KW_FROM source=valueExpression RR_BRACKET #extract
// | (SUBSTR | SUBSTRING) LR_BRACKET str=valueExpression (KW_FROM | COMMA) pos=valueExpression // | (SUBSTR | SUBSTRING) LR_BRACKET str=valueExpression (KW_FROM | COMMA) pos=valueExpression
// ((KW_FOR | COMMA) len=valueExpression)? RR_BRACKET #substring // ((KW_FOR | COMMA) len=valueExpression)? RR_BRACKET #substring
@ -736,7 +737,6 @@ functionNameCreate
functionName functionName
: reservedKeywordsUsedAsFuncName : reservedKeywordsUsedAsFuncName
| nonReservedKeywords
| uid | uid
; ;
@ -786,10 +786,6 @@ intervalValue
| STRING_LITERAL | STRING_LITERAL
; ;
columnAlias
: KW_AS? identifier identifierList?
;
tableAlias tableAlias
: KW_AS? identifier identifierList? : KW_AS? identifier identifierList?
; ;
@ -1013,11 +1009,14 @@ timeIntervalUnit
; ;
reservedKeywordsUsedAsFuncParam reservedKeywordsUsedAsFuncParam
: KW_LEADING : KW_ARRAY
| KW_TRAILING
| KW_BOTH
| KW_ALL | KW_ALL
| KW_BOTH
| KW_CURRENT_TIMESTAMP
| KW_DISTINCT | KW_DISTINCT
| KW_LEADING
| KW_TRAILING
| KW_VALUE
| ASTERISK_SIGN | ASTERISK_SIGN
; ;
@ -1025,405 +1024,140 @@ reservedKeywordsUsedAsFuncName
: KW_ABS : KW_ABS
| KW_ARRAY | KW_ARRAY
| KW_AVG | KW_AVG
| KW_CARDINALITY
| KW_CAST | KW_CAST
| KW_CEIL | KW_CEIL
| KW_CEILING
| KW_COALESCE | KW_COALESCE
| KW_COLLECT | KW_COLLECT
| KW_COUNT | KW_COUNT
| KW_CUME_DIST
| KW_CURRENT_DATE
| KW_CURRENT_TIME
| KW_CURRENT_TIMESTAMP
| KW_DATE | KW_DATE
| KW_DAYOFWEEK
| KW_DAYOFYEAR
| KW_DENSE_RANK
| KW_ELEMENT
| KW_EXP
| KW_EXTRACT
| KW_FIRST_VALUE
| KW_FLOOR
| KW_GROUPING | KW_GROUPING
| KW_HOUR | KW_HOUR
| KW_IF | KW_IF
| KW_LAG | KW_LAG
| KW_LAST_VALUE
| KW_LEAD
| KW_LEFT | KW_LEFT
| KW_LN
| KW_LOCALTIME
| KW_LOCALTIMESTAMP
| KW_LOWER
| KW_MAP | KW_MAP
| KW_MAX
| KW_MIN
| KW_MINUTE | KW_MINUTE
| KW_MOD
| KW_MONTH | KW_MONTH
| KW_NULLIF
| KW_NTILE
| KW_OVERLAY | KW_OVERLAY
| KW_PERCENT_RANK
| KW_POSITION | KW_POSITION
| KW_POWER | KW_POWER
| KW_QUARTER | KW_QUARTER
| KW_ROW | KW_ROW
| KW_ROWS | KW_ROWS
| KW_ROW_NUMBER
| KW_RANK | KW_RANK
| KW_RIGHT | KW_RIGHT
| KW_SECOND | KW_SECOND
| KW_STDDEV_POP
| KW_STDDEV_SAMP
| KW_SUBSTRING | KW_SUBSTRING
| KW_SUM | KW_SUM
| KW_TIME | KW_TIME
| KW_TIMESTAMP | KW_TIMESTAMP
| KW_TIMESTAMP_DIFF
| KW_TRIM
| KW_TRUNCATE | KW_TRUNCATE
| KW_TRY_CAST
| KW_UPPER | KW_UPPER
| KW_VAR_POP
| KW_VAR_SAMP
| KW_WEEK | KW_WEEK
| KW_YEAR | KW_YEAR
; ;
reservedKeywords
: KW_ABS
| KW_ALL
| KW_ALLOW
| KW_ALTER
| KW_AND
| KW_ANY
| KW_ARE
| KW_ARRAY
| KW_AS
| KW_ASYMMETRIC
| KW_AT
| KW_AVG
| KW_BEGIN
| KW_BETWEEN
| KW_BIGINT
| KW_BINARY
| KW_BIT
| KW_BLOB
| KW_BOOLEAN
| KW_BOTH
| KW_BY
| KW_CALL
| KW_CALLED
| KW_CASCADED
| KW_CASE
| KW_CAST
| KW_CEIL
| KW_CHAR
| KW_CHARACTER
| KW_CHECK
| KW_CLOB
| KW_CLOSE
| KW_COALESCE
| KW_COLLATE
| KW_COLLECT
| KW_COLUMN
| KW_COMMIT
| KW_CONNECT
| KW_CONSTRAINT
| KW_CONTAINS
| KW_CONVERT
| KW_COUNT
| KW_CREATE
| KW_CROSS
| KW_CUBE
| KW_CURRENT
| KW_CURSOR
| KW_CYCLE
| KW_DATE
| KW_DATETIME
| KW_DAY
| KW_DEC
| KW_DECIMAL
| KW_DECLARE
| KW_DEFAULT
| KW_DEFINE
| KW_DELETE
| KW_DESCRIBE
| KW_DISTINCT
| KW_DOUBLE
| KW_DROP
| KW_EACH
| KW_ELSE
| KW_END
| KW_EQUALS
| KW_EXCEPT
| KW_EXECUTE
| KW_EXISTS
| KW_EXPLAIN
| KW_EXTERNAL
| KW_EXTRACT
| KW_FALSE
| KW_FLOAT
| KW_FOR
| KW_FROM
| KW_FULL
| KW_FUNCTION
| KW_GLOBAL
| KW_GRANT
| KW_GROUP
| KW_GROUPING
| KW_GROUPS
| KW_HAVING
| KW_HOUR
| KW_IMPORT
| KW_IN
| KW_INCLUDING
| KW_INNER
| KW_INOUT
| KW_INSERT
| KW_INT
| KW_INTEGER
| KW_INTERSECT
| KW_INTERVAL
| KW_INTO
| KW_IS
| KW_JOIN
| KW_LAG
| KW_LANGUAGE
| KW_LATERAL
| KW_LEADING
| KW_LEFT
| KW_LIKE
| KW_LIMIT
| KW_LOCAL
| KW_MATCH
| KW_MATCH_RECOGNIZE
| KW_MEASURES
| KW_MERGE
| KW_METADATA
| KW_MINUS
| KW_MINUTE
| KW_MODIFIES
| KW_MODULE
| KW_MONTH
| KW_MULTISET
| KW_NATURAL
| KW_NEXT
| KW_NO
| KW_NONE
| KW_NOT
| KW_NULL
| KW_NUMERIC
| KW_OF
| KW_OFFSET
| KW_ON
| KW_ONE
| KW_OR
| KW_ORDER
| KW_OUT
| KW_OUTER
| KW_OVER
| KW_OVERLAY
| KW_PARTITION
| KW_PATTERN
| KW_PER
| KW_PERCENT
| KW_PERIOD
| KW_POSITION
| KW_PRIMARY
| KW_RANGE
| KW_RANK
| KW_RESET
| KW_REVOKE
| KW_RIGHT
| KW_RLIKE
| KW_ROLLBACK
| KW_ROLLUP
| KW_ROW
| KW_ROWS
| KW_SECOND
| KW_SELECT
| KW_SET
| KW_SHOW
| KW_SIMILAR
| KW_SKIP
| KW_SMALLINT
| KW_START
| KW_STATIC
| KW_SUBSTRING
| KW_SUM
| KW_SYSTEM_TIME
| KW_SYSTEM
| KW_SYSTEM_TIME
| KW_SYSTEM_USER
| KW_TABLE
| KW_TABLESAMPLE
| KW_THEN
| KW_TIME
| KW_TIMESTAMP
| KW_TINYINT
| KW_TO
| KW_TRUE
| KW_TRUNCATE
| KW_UNION
| KW_UNIQUE
| KW_UNKNOWN
| KW_UNNEST
| KW_UPPER
| KW_UPSERT
| KW_USER
| KW_USING
| KW_VALUE
| KW_VALUES
| KW_VARBINARY
| KW_VARCHAR
| KW_WHEN
| KW_WHERE
| KW_WINDOW
| KW_WITH
| KW_WITHIN
| KW_WITHOUT
| KW_YEAR
;
nonReservedKeywords nonReservedKeywords
:KW_ADD : KW_ADD
|KW_ADMIN | KW_AFTER
|KW_AFTER | KW_ASC
|KW_ANALYZE | KW_CASCADE
|KW_ASC | KW_CATALOG
|KW_BEFORE | KW_CENTURY
|KW_BYTES | KW_CONFIG
|KW_CASCADE | KW_CONSTRAINTS
|KW_CATALOG | KW_CUMULATE
|KW_CATALOGS | KW_DATA
|KW_CENTURY | KW_DATABASE
|KW_CHAIN | KW_DAYS
|KW_CHANGELOG_MODE | KW_DECADE
|KW_CHARACTERS | KW_DESC
|KW_COMMENT | KW_DESCRIPTOR
|KW_COMPACT | KW_DIV
|KW_COLUMNS | KW_ENGINE
|KW_CONSTRAINTS | KW_EPOCH
|KW_CONSTRUCTOR | KW_EXCLUDING
|KW_CUMULATE | KW_FILE
|KW_DATA | KW_FIRST
|KW_DATABASE | KW_GENERATED
|KW_DATABASES | KW_HOP
|KW_DAYS | KW_HOURS
|KW_DECADE | KW_IGNORE
|KW_DEFINED | KW_INCLUDING
|KW_DESC | KW_JAR
|KW_DESCRIPTOR | KW_JARS
|KW_DIV | KW_JAVA
|KW_ENCODING | KW_KEY
|KW_ENFORCED | KW_LAST
|KW_ENGINE | KW_LOAD
|KW_ERROR | KW_MAP
|KW_ESTIMATED_COST | KW_MICROSECOND
|KW_EXCEPTION | KW_MILLENNIUM
|KW_EXCLUDE | KW_MILLISECOND
|KW_EXCLUDING | KW_MINUTES
|KW_EXTENDED | KW_MONTHS
|KW_FILE | KW_NANOSECOND
|KW_FINAL | KW_NULLS
|KW_FIRST | KW_OPTIONS
|KW_FOLLOWING | KW_PAST
|KW_FORMAT | KW_PLAN
|KW_FORTRAN | KW_PRECEDING
|KW_FOUND | KW_PYTHON
|KW_FRAC_SECOND | KW_PYTHON_ARCHIVES
|KW_FUNCTIONS | KW_PYTHON_DEPENDENCIES
|KW_GENERAL | KW_PYTHON_FILES
|KW_GENERATED | KW_PYTHON_JAR
|KW_GO | KW_PYTHON_PARAMETER
|KW_GOTO | KW_PYTHON_REQUIREMENTS
|KW_GRANTED | KW_QUARTER
|KW_HOP | KW_REMOVE
|KW_HOURS | KW_RESTRICT
|KW_IF | KW_SECONDS
|KW_IGNORE | KW_SESSION
|KW_INCREMENT | KW_SETS
|KW_INPUT | KW_SIZE
|KW_INVOKER | KW_SLIDE
|KW_JAR | KW_STEP
|KW_JARS | KW_TEMPORARY
|KW_JAVA | KW_TIMECOL
|KW_JSON | KW_TUMBLE
|KW_JSON_EXECUTION_PLAN | KW_UNLOAD
|KW_KEY | KW_VIEW
|KW_KEY_MEMBER | KW_WEEK
|KW_KEY_TYPE | KW_YEARS
|KW_LABEL | KW_ZONE
|KW_LAST
|KW_LENGTH
|KW_LEVEL
|KW_LOAD
|KW_MAP
|KW_MICROSECOND
|KW_MILLENNIUM
|KW_MILLISECOND
|KW_MINUTES
|KW_MINVALUE
|KW_MODIFY
|KW_MODULES
|KW_MONTHS
|KW_NANOSECOND
|KW_NULLS
|KW_NUMBER
|KW_OPTION
|KW_OPTIONS
|KW_ORDERING
|KW_OUTPUT
|KW_OVERWRITE
|KW_OVERWRITING
|KW_PARTITIONED
|KW_PARTITIONS
|KW_PASSING
|KW_PAST
|KW_PATH
|KW_PLACING
|KW_PLAN
|KW_PRECEDING
|KW_PRESERVE
|KW_PRIOR
|KW_PRIVILEGES
|KW_PUBLIC
|KW_PYTHON
|KW_PYTHON_FILES
|KW_PYTHON_REQUIREMENTS
|KW_PYTHON_DEPENDENCIES
|KW_PYTHON_JAR
|KW_PYTHON_ARCHIVES
|KW_PYTHON_PARAMETER
|KW_QUARTER
|KW_RAW
|KW_READ
|KW_RELATIVE
|KW_REMOVE
|KW_RENAME
|KW_REPLACE
|KW_RESPECT
|KW_RESTART
|KW_RESTRICT
|KW_ROLE
|KW_ROW_COUNT
|KW_SCALA
|KW_SCALAR
|KW_SCALE
|KW_SCHEMA
|KW_SECONDS
|KW_SECTION
|KW_SECURITY
|KW_SELF
|KW_SERVER
|KW_SERVER_NAME
|KW_SESSION
|KW_SETS
|KW_SIMPLE
|KW_SIZE
|KW_SLIDE
|KW_SOURCE
|KW_SPACE
|KW_STATE
|KW_STATEMENT
|KW_STEP
|KW_STRING
|KW_STRUCTURE
|KW_STYLE
|KW_TABLES
|KW_TEMPORARY
|KW_TIMECOL
|KW_TIMESTAMP_LTZ
|KW_TIMESTAMPADD
|KW_TIMESTAMPDIFF
|KW_TRANSFORM
|KW_TUMBLE
|KW_TYPE
|KW_UNDER
|KW_UNLOAD
|KW_USAGE
|KW_USE
|KW_UTF16
|KW_UTF32
|KW_UTF8
|KW_VERSION
|KW_VIEW
|KW_VIEWS
|KW_VIRTUAL
|KW_WATERMARK
|KW_WATERMARKS
|KW_WEEK
|KW_WORK
|KW_WRAPPER
|KW_YEARS
|KW_ZONE
; ;

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

File diff suppressed because one or more lines are too long

View File

@ -25,6 +25,7 @@ import { SubscriptContext } from "./FlinkSqlParser";
import { ColumnReferenceContext } from "./FlinkSqlParser"; import { ColumnReferenceContext } from "./FlinkSqlParser";
import { DereferenceContext } from "./FlinkSqlParser"; import { DereferenceContext } from "./FlinkSqlParser";
import { ParenthesizedExpressionContext } from "./FlinkSqlParser"; import { ParenthesizedExpressionContext } from "./FlinkSqlParser";
import { DateFunctionExpressionContext } from "./FlinkSqlParser";
import { ErrorIdentContext } from "./FlinkSqlParser"; import { ErrorIdentContext } from "./FlinkSqlParser";
import { RealIdentContext } from "./FlinkSqlParser"; import { RealIdentContext } from "./FlinkSqlParser";
import { IdentityTransformContext } from "./FlinkSqlParser"; import { IdentityTransformContext } from "./FlinkSqlParser";
@ -181,7 +182,6 @@ import { MultiUnitsIntervalContext } from "./FlinkSqlParser";
import { ErrorCapturingUnitToUnitIntervalContext } from "./FlinkSqlParser"; import { ErrorCapturingUnitToUnitIntervalContext } from "./FlinkSqlParser";
import { UnitToUnitIntervalContext } from "./FlinkSqlParser"; import { UnitToUnitIntervalContext } from "./FlinkSqlParser";
import { IntervalValueContext } from "./FlinkSqlParser"; import { IntervalValueContext } from "./FlinkSqlParser";
import { ColumnAliasContext } from "./FlinkSqlParser";
import { TableAliasContext } from "./FlinkSqlParser"; import { TableAliasContext } from "./FlinkSqlParser";
import { ErrorCapturingIdentifierContext } from "./FlinkSqlParser"; import { ErrorCapturingIdentifierContext } from "./FlinkSqlParser";
import { ErrorCapturingIdentifierExtraContext } from "./FlinkSqlParser"; import { ErrorCapturingIdentifierExtraContext } from "./FlinkSqlParser";
@ -222,7 +222,6 @@ import { TimePointUnitContext } from "./FlinkSqlParser";
import { TimeIntervalUnitContext } from "./FlinkSqlParser"; import { TimeIntervalUnitContext } from "./FlinkSqlParser";
import { ReservedKeywordsUsedAsFuncParamContext } from "./FlinkSqlParser"; import { ReservedKeywordsUsedAsFuncParamContext } from "./FlinkSqlParser";
import { ReservedKeywordsUsedAsFuncNameContext } from "./FlinkSqlParser"; import { ReservedKeywordsUsedAsFuncNameContext } from "./FlinkSqlParser";
import { ReservedKeywordsContext } from "./FlinkSqlParser";
import { NonReservedKeywordsContext } from "./FlinkSqlParser"; import { NonReservedKeywordsContext } from "./FlinkSqlParser";
@ -517,6 +516,19 @@ export interface FlinkSqlParserListener extends ParseTreeListener {
*/ */
exitParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => void; exitParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => void;
/**
* Enter a parse tree produced by the `dateFunctionExpression`
* labeled alternative in `FlinkSqlParser.primaryExpression`.
* @param ctx the parse tree
*/
enterDateFunctionExpression?: (ctx: DateFunctionExpressionContext) => void;
/**
* Exit a parse tree produced by the `dateFunctionExpression`
* labeled alternative in `FlinkSqlParser.primaryExpression`.
* @param ctx the parse tree
*/
exitDateFunctionExpression?: (ctx: DateFunctionExpressionContext) => void;
/** /**
* Enter a parse tree produced by the `errorIdent` * Enter a parse tree produced by the `errorIdent`
* labeled alternative in `FlinkSqlParser.errorCapturingIdentifierExtra`. * labeled alternative in `FlinkSqlParser.errorCapturingIdentifierExtra`.
@ -2251,17 +2263,6 @@ export interface FlinkSqlParserListener extends ParseTreeListener {
*/ */
exitIntervalValue?: (ctx: IntervalValueContext) => void; exitIntervalValue?: (ctx: IntervalValueContext) => void;
/**
* Enter a parse tree produced by `FlinkSqlParser.columnAlias`.
* @param ctx the parse tree
*/
enterColumnAlias?: (ctx: ColumnAliasContext) => void;
/**
* Exit a parse tree produced by `FlinkSqlParser.columnAlias`.
* @param ctx the parse tree
*/
exitColumnAlias?: (ctx: ColumnAliasContext) => void;
/** /**
* Enter a parse tree produced by `FlinkSqlParser.tableAlias`. * Enter a parse tree produced by `FlinkSqlParser.tableAlias`.
* @param ctx the parse tree * @param ctx the parse tree
@ -2702,17 +2703,6 @@ export interface FlinkSqlParserListener extends ParseTreeListener {
*/ */
exitReservedKeywordsUsedAsFuncName?: (ctx: ReservedKeywordsUsedAsFuncNameContext) => void; exitReservedKeywordsUsedAsFuncName?: (ctx: ReservedKeywordsUsedAsFuncNameContext) => void;
/**
* Enter a parse tree produced by `FlinkSqlParser.reservedKeywords`.
* @param ctx the parse tree
*/
enterReservedKeywords?: (ctx: ReservedKeywordsContext) => void;
/**
* Exit a parse tree produced by `FlinkSqlParser.reservedKeywords`.
* @param ctx the parse tree
*/
exitReservedKeywords?: (ctx: ReservedKeywordsContext) => void;
/** /**
* Enter a parse tree produced by `FlinkSqlParser.nonReservedKeywords`. * Enter a parse tree produced by `FlinkSqlParser.nonReservedKeywords`.
* @param ctx the parse tree * @param ctx the parse tree

View File

@ -25,6 +25,7 @@ import { SubscriptContext } from "./FlinkSqlParser";
import { ColumnReferenceContext } from "./FlinkSqlParser"; import { ColumnReferenceContext } from "./FlinkSqlParser";
import { DereferenceContext } from "./FlinkSqlParser"; import { DereferenceContext } from "./FlinkSqlParser";
import { ParenthesizedExpressionContext } from "./FlinkSqlParser"; import { ParenthesizedExpressionContext } from "./FlinkSqlParser";
import { DateFunctionExpressionContext } from "./FlinkSqlParser";
import { ErrorIdentContext } from "./FlinkSqlParser"; import { ErrorIdentContext } from "./FlinkSqlParser";
import { RealIdentContext } from "./FlinkSqlParser"; import { RealIdentContext } from "./FlinkSqlParser";
import { IdentityTransformContext } from "./FlinkSqlParser"; import { IdentityTransformContext } from "./FlinkSqlParser";
@ -181,7 +182,6 @@ import { MultiUnitsIntervalContext } from "./FlinkSqlParser";
import { ErrorCapturingUnitToUnitIntervalContext } from "./FlinkSqlParser"; import { ErrorCapturingUnitToUnitIntervalContext } from "./FlinkSqlParser";
import { UnitToUnitIntervalContext } from "./FlinkSqlParser"; import { UnitToUnitIntervalContext } from "./FlinkSqlParser";
import { IntervalValueContext } from "./FlinkSqlParser"; import { IntervalValueContext } from "./FlinkSqlParser";
import { ColumnAliasContext } from "./FlinkSqlParser";
import { TableAliasContext } from "./FlinkSqlParser"; import { TableAliasContext } from "./FlinkSqlParser";
import { ErrorCapturingIdentifierContext } from "./FlinkSqlParser"; import { ErrorCapturingIdentifierContext } from "./FlinkSqlParser";
import { ErrorCapturingIdentifierExtraContext } from "./FlinkSqlParser"; import { ErrorCapturingIdentifierExtraContext } from "./FlinkSqlParser";
@ -222,7 +222,6 @@ import { TimePointUnitContext } from "./FlinkSqlParser";
import { TimeIntervalUnitContext } from "./FlinkSqlParser"; import { TimeIntervalUnitContext } from "./FlinkSqlParser";
import { ReservedKeywordsUsedAsFuncParamContext } from "./FlinkSqlParser"; import { ReservedKeywordsUsedAsFuncParamContext } from "./FlinkSqlParser";
import { ReservedKeywordsUsedAsFuncNameContext } from "./FlinkSqlParser"; import { ReservedKeywordsUsedAsFuncNameContext } from "./FlinkSqlParser";
import { ReservedKeywordsContext } from "./FlinkSqlParser";
import { NonReservedKeywordsContext } from "./FlinkSqlParser"; import { NonReservedKeywordsContext } from "./FlinkSqlParser";
@ -410,6 +409,14 @@ export interface FlinkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
*/ */
visitParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => Result; visitParenthesizedExpression?: (ctx: ParenthesizedExpressionContext) => Result;
/**
* Visit a parse tree produced by the `dateFunctionExpression`
* labeled alternative in `FlinkSqlParser.primaryExpression`.
* @param ctx the parse tree
* @return the visitor result
*/
visitDateFunctionExpression?: (ctx: DateFunctionExpressionContext) => Result;
/** /**
* Visit a parse tree produced by the `errorIdent` * Visit a parse tree produced by the `errorIdent`
* labeled alternative in `FlinkSqlParser.errorCapturingIdentifierExtra`. * labeled alternative in `FlinkSqlParser.errorCapturingIdentifierExtra`.
@ -1511,13 +1518,6 @@ export interface FlinkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
*/ */
visitIntervalValue?: (ctx: IntervalValueContext) => Result; visitIntervalValue?: (ctx: IntervalValueContext) => Result;
/**
* Visit a parse tree produced by `FlinkSqlParser.columnAlias`.
* @param ctx the parse tree
* @return the visitor result
*/
visitColumnAlias?: (ctx: ColumnAliasContext) => Result;
/** /**
* Visit a parse tree produced by `FlinkSqlParser.tableAlias`. * Visit a parse tree produced by `FlinkSqlParser.tableAlias`.
* @param ctx the parse tree * @param ctx the parse tree
@ -1798,13 +1798,6 @@ export interface FlinkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
*/ */
visitReservedKeywordsUsedAsFuncName?: (ctx: ReservedKeywordsUsedAsFuncNameContext) => Result; visitReservedKeywordsUsedAsFuncName?: (ctx: ReservedKeywordsUsedAsFuncNameContext) => Result;
/**
* Visit a parse tree produced by `FlinkSqlParser.reservedKeywords`.
* @param ctx the parse tree
* @return the visitor result
*/
visitReservedKeywords?: (ctx: ReservedKeywordsContext) => Result;
/** /**
* Visit a parse tree produced by `FlinkSqlParser.nonReservedKeywords`. * Visit a parse tree produced by `FlinkSqlParser.nonReservedKeywords`.
* @param ctx the parse tree * @param ctx the parse tree

View File

@ -53,8 +53,8 @@ describe('Flink SQL Token Suggestion', () => {
'CURRENT', 'CURRENT',
'CATALOGS', 'CATALOGS',
'DATABASES', 'DATABASES',
'JARS',
'VIEWS', 'VIEWS',
'JARS',
]); ]);
}); });
}); });

View File

@ -109,7 +109,7 @@ CREATE TABLE catalog1.db1.table1 (
attr17 MAP<INT, BIGINT>, attr17 MAP<INT, BIGINT>,
name1 VARCHAR(64), name1 VARCHAR(64),
message ROW<data ROW<UPO_TIMESTAMP VARCHAR(20)>>, message ROW<data ROW<UPO_TIMESTAMP VARCHAR(20)>>,
raw RAW('class', 'snapshot') `raw` RAW('class', 'snapshot')
) WITH ('connector' = 'kafka'); ) WITH ('connector' = 'kafka');
CREATE TABLE IF NOT EXISTS tbl1 ( CREATE TABLE IF NOT EXISTS tbl1 (