feat: support spark sql auto complete (#179)
* refactor: spark sql g4 * feat: support spark sql suggestion * test: spark sql suggestion unit test * test: hive spell check * feat: spark sql keyword has multiple values * test: KW_NOT KW_RLIKE split into two value --------- Co-authored-by: liuyi <liuyi@dtstack.com>
This commit is contained in:
parent
53ead45ff5
commit
4d1dfa676f
@ -238,7 +238,7 @@ KW_NANOSECOND: 'NANOSECOND';
|
|||||||
KW_NANOSECONDS: 'NANOSECONDS';
|
KW_NANOSECONDS: 'NANOSECONDS';
|
||||||
KW_NATURAL: 'NATURAL';
|
KW_NATURAL: 'NATURAL';
|
||||||
KW_NO: 'NO';
|
KW_NO: 'NO';
|
||||||
KW_NOT: 'NOT' | '!';
|
KW_NOT: 'NOT';
|
||||||
KW_NULL: 'NULL';
|
KW_NULL: 'NULL';
|
||||||
KW_NULLS: 'NULLS';
|
KW_NULLS: 'NULLS';
|
||||||
KW_NUMERIC: 'NUMERIC';
|
KW_NUMERIC: 'NUMERIC';
|
||||||
@ -290,7 +290,8 @@ KW_RESPECT: 'RESPECT';
|
|||||||
KW_RESTRICT: 'RESTRICT';
|
KW_RESTRICT: 'RESTRICT';
|
||||||
KW_REVOKE: 'REVOKE';
|
KW_REVOKE: 'REVOKE';
|
||||||
KW_RIGHT: 'RIGHT';
|
KW_RIGHT: 'RIGHT';
|
||||||
KW_RLIKE: 'RLIKE' | 'REGEXP';
|
KW_RLIKE: 'RLIKE';
|
||||||
|
KW_REGEXP: 'REGEXP';
|
||||||
KW_ROLE: 'ROLE';
|
KW_ROLE: 'ROLE';
|
||||||
KW_ROLES: 'ROLES';
|
KW_ROLES: 'ROLES';
|
||||||
KW_ROLLBACK: 'ROLLBACK';
|
KW_ROLLBACK: 'ROLLBACK';
|
||||||
@ -328,6 +329,7 @@ KW_STRUCT: 'STRUCT';
|
|||||||
KW_SUBSTR: 'SUBSTR';
|
KW_SUBSTR: 'SUBSTR';
|
||||||
KW_SUBSTRING: 'SUBSTRING';
|
KW_SUBSTRING: 'SUBSTRING';
|
||||||
KW_SYNC: 'SYNC';
|
KW_SYNC: 'SYNC';
|
||||||
|
KW_SYSTEM: 'SYSTEM';
|
||||||
KW_SYSTEM_TIME: 'SYSTEM_TIME';
|
KW_SYSTEM_TIME: 'SYSTEM_TIME';
|
||||||
KW_SYSTEM_VERSION: 'SYSTEM_VERSION';
|
KW_SYSTEM_VERSION: 'SYSTEM_VERSION';
|
||||||
KW_TABLE: 'TABLE';
|
KW_TABLE: 'TABLE';
|
||||||
@ -335,7 +337,7 @@ KW_TABLES: 'TABLES';
|
|||||||
KW_TABLESAMPLE: 'TABLESAMPLE';
|
KW_TABLESAMPLE: 'TABLESAMPLE';
|
||||||
KW_TARGET: 'TARGET';
|
KW_TARGET: 'TARGET';
|
||||||
KW_TBLPROPERTIES: 'TBLPROPERTIES';
|
KW_TBLPROPERTIES: 'TBLPROPERTIES';
|
||||||
KW_TEMPORARY: 'TEMPORARY' | 'TEMP';
|
KW_TEMPORARY: 'TEMPORARY';
|
||||||
KW_TERMINATED: 'TERMINATED';
|
KW_TERMINATED: 'TERMINATED';
|
||||||
KW_THEN: 'THEN';
|
KW_THEN: 'THEN';
|
||||||
KW_TIME: 'TIME';
|
KW_TIME: 'TIME';
|
||||||
@ -402,6 +404,7 @@ LTE : '<=' | '!>';
|
|||||||
GT : '>';
|
GT : '>';
|
||||||
GTE : '>=' | '!<';
|
GTE : '>=' | '!<';
|
||||||
|
|
||||||
|
NOT: '!';
|
||||||
PLUS: '+';
|
PLUS: '+';
|
||||||
MINUS: '-';
|
MINUS: '-';
|
||||||
ASTERISK: '*';
|
ASTERISK: '*';
|
||||||
|
@ -54,34 +54,29 @@ singleStatement
|
|||||||
: statement SEMICOLON ?
|
: statement SEMICOLON ?
|
||||||
;
|
;
|
||||||
|
|
||||||
tableIdentifierReference: identifierReference;
|
|
||||||
viewIdentifierReference: identifierReference;
|
|
||||||
functionIdentifierReference: identifierReference;
|
|
||||||
namespaceIdentifierReference: identifierReference;
|
|
||||||
|
|
||||||
statement
|
statement
|
||||||
: query
|
: query
|
||||||
| ctes? dmlStatementNoWith
|
| ctes? dmlStatementNoWith
|
||||||
| KW_USE identifierReference
|
| KW_USE dbSchemaName
|
||||||
| KW_USE namespace namespaceIdentifierReference
|
| KW_USE dbSchema dbSchemaName
|
||||||
| KW_SET KW_CATALOG (identifier | stringLit)
|
| KW_SET KW_CATALOG (identifier | stringLit)
|
||||||
| KW_CREATE namespace (KW_IF KW_NOT KW_EXISTS)? namespaceIdentifierReference
|
| KW_CREATE dbSchema (ifNotExists)? dbSchemaNameCreate
|
||||||
(commentSpec |
|
(commentSpec |
|
||||||
locationSpec |
|
locationSpec |
|
||||||
(KW_WITH (KW_DBPROPERTIES | KW_PROPERTIES) propertyList))*
|
(KW_WITH (KW_DBPROPERTIES | KW_PROPERTIES) propertyList))*
|
||||||
| KW_ALTER namespace namespaceIdentifierReference
|
| KW_ALTER dbSchema dbSchemaName
|
||||||
KW_SET (KW_DBPROPERTIES | KW_PROPERTIES) propertyList
|
KW_SET (KW_DBPROPERTIES | KW_PROPERTIES) propertyList
|
||||||
| KW_ALTER namespace namespaceIdentifierReference
|
| KW_ALTER dbSchema dbSchemaName
|
||||||
KW_SET locationSpec
|
KW_SET locationSpec
|
||||||
| KW_DROP namespace (KW_IF KW_EXISTS)? namespaceIdentifierReference
|
| KW_DROP dbSchema (ifExists)? dbSchemaName
|
||||||
(KW_RESTRICT | KW_CASCADE)?
|
(KW_RESTRICT | KW_CASCADE)?
|
||||||
| KW_SHOW namespaces ((KW_FROM | KW_IN) multipartIdentifier)?
|
| KW_SHOW dbSchemas ((KW_FROM | KW_IN) multipartIdentifier)?
|
||||||
(KW_LIKE? pattern=stringLit)?
|
(KW_LIKE? pattern=stringLit)?
|
||||||
| createTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider?
|
| createTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider?
|
||||||
createTableClauses
|
createTableClauses
|
||||||
(KW_AS? query)?
|
(KW_AS? query)?
|
||||||
| KW_CREATE KW_TABLE (KW_IF KW_NOT KW_EXISTS)? target=tableIdentifier
|
| KW_CREATE KW_TABLE (ifNotExists)? target=tableNameCreate
|
||||||
KW_LIKE source=tableIdentifier
|
KW_LIKE source=tableName
|
||||||
(tableProvider |
|
(tableProvider |
|
||||||
rowFormat |
|
rowFormat |
|
||||||
createFileFormat |
|
createFileFormat |
|
||||||
@ -90,112 +85,111 @@ statement
|
|||||||
| replaceTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider?
|
| replaceTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider?
|
||||||
createTableClauses
|
createTableClauses
|
||||||
(KW_AS? query)?
|
(KW_AS? query)?
|
||||||
| KW_ANALYZE KW_TABLE tableIdentifierReference partitionSpec? KW_COMPUTE KW_STATISTICS
|
| KW_ANALYZE KW_TABLE tableName partitionSpec? KW_COMPUTE KW_STATISTICS
|
||||||
(identifier | KW_FOR KW_COLUMNS identifierSeq | KW_FOR KW_ALL KW_COLUMNS)?
|
(identifier | KW_FOR KW_COLUMNS identifierSeq | KW_FOR KW_ALL KW_COLUMNS)?
|
||||||
| KW_ANALYZE KW_TABLES ((KW_FROM | KW_IN) tableIdentifierReference)? KW_COMPUTE KW_STATISTICS
|
| KW_ANALYZE KW_TABLES ((KW_FROM | KW_IN) dbSchemaName)? KW_COMPUTE KW_STATISTICS
|
||||||
(identifier)?
|
(identifier)?
|
||||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
| KW_ALTER KW_TABLE tableName
|
||||||
KW_ADD (KW_COLUMN | KW_COLUMNS)
|
KW_ADD (KW_COLUMN | KW_COLUMNS)
|
||||||
qualifiedColTypeWithPositionList
|
qualifiedColTypeWithPositionList
|
||||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
| KW_ALTER KW_TABLE tableName
|
||||||
KW_ADD (KW_COLUMN | KW_COLUMNS)
|
KW_ADD (KW_COLUMN | KW_COLUMNS)
|
||||||
LEFT_PAREN qualifiedColTypeWithPositionList RIGHT_PAREN
|
LEFT_PAREN qualifiedColTypeWithPositionList RIGHT_PAREN
|
||||||
| KW_ALTER KW_TABLE table=tableIdentifierReference
|
| KW_ALTER KW_TABLE table=tableName
|
||||||
KW_RENAME KW_COLUMN
|
KW_RENAME KW_COLUMN
|
||||||
multipartIdentifier KW_TO errorCapturingIdentifier
|
multipartIdentifier KW_TO errorCapturingIdentifier
|
||||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
| KW_ALTER KW_TABLE tableName
|
||||||
KW_DROP (KW_COLUMN | KW_COLUMNS) (KW_IF KW_EXISTS)?
|
KW_DROP (KW_COLUMN | KW_COLUMNS) (ifExists)?
|
||||||
LEFT_PAREN multipartIdentifierList RIGHT_PAREN
|
LEFT_PAREN multipartIdentifierList RIGHT_PAREN
|
||||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
| KW_ALTER KW_TABLE tableName
|
||||||
KW_DROP (KW_COLUMN | KW_COLUMNS) (KW_IF KW_EXISTS)?
|
KW_DROP (KW_COLUMN | KW_COLUMNS) (ifExists)?
|
||||||
multipartIdentifierList
|
multipartIdentifierList
|
||||||
| KW_ALTER (KW_TABLE | KW_VIEW) (tableIdentifierReference | viewIdentifierReference)
|
| KW_ALTER (KW_TABLE | KW_VIEW) (tableName | viewName)
|
||||||
KW_RENAME KW_TO multipartIdentifier
|
KW_RENAME KW_TO multipartIdentifier
|
||||||
| KW_ALTER (KW_TABLE | KW_VIEW) (tableIdentifierReference | viewIdentifierReference)
|
| KW_ALTER (KW_TABLE | KW_VIEW) (tableName | viewName)
|
||||||
KW_SET KW_TBLPROPERTIES propertyList
|
KW_SET KW_TBLPROPERTIES propertyList
|
||||||
| KW_ALTER (KW_TABLE | KW_VIEW) (tableIdentifierReference | viewIdentifierReference)
|
| KW_ALTER (KW_TABLE | KW_VIEW) (tableName | viewName)
|
||||||
KW_UNSET KW_TBLPROPERTIES (KW_IF KW_EXISTS)? propertyList
|
KW_UNSET KW_TBLPROPERTIES (ifExists)? propertyList
|
||||||
| KW_ALTER KW_TABLE table=tableIdentifierReference
|
| KW_ALTER KW_TABLE table=tableName
|
||||||
(KW_ALTER | KW_CHANGE) KW_COLUMN? column=multipartIdentifier
|
(KW_ALTER | KW_CHANGE) KW_COLUMN? column=multipartIdentifier
|
||||||
alterColumnAction?
|
alterColumnAction?
|
||||||
| KW_ALTER KW_TABLE table=tableIdentifierReference partitionSpec?
|
| KW_ALTER KW_TABLE table=tableName partitionSpec?
|
||||||
KW_CHANGE KW_COLUMN?
|
KW_CHANGE KW_COLUMN?
|
||||||
colName=multipartIdentifier colType colPosition?
|
colName=multipartIdentifier colType colPosition?
|
||||||
| KW_ALTER KW_TABLE table=tableIdentifierReference partitionSpec?
|
| KW_ALTER KW_TABLE table=tableName partitionSpec?
|
||||||
KW_REPLACE KW_COLUMNS
|
KW_REPLACE KW_COLUMNS
|
||||||
LEFT_PAREN qualifiedColTypeWithPositionList
|
LEFT_PAREN qualifiedColTypeWithPositionList
|
||||||
RIGHT_PAREN
|
RIGHT_PAREN
|
||||||
| KW_ALTER KW_TABLE tableIdentifierReference (partitionSpec)?
|
| KW_ALTER KW_TABLE tableName (partitionSpec)?
|
||||||
KW_SET KW_SERDE stringLit (KW_WITH KW_SERDEPROPERTIES propertyList)?
|
KW_SET KW_SERDE stringLit (KW_WITH KW_SERDEPROPERTIES propertyList)?
|
||||||
| KW_ALTER KW_TABLE tableIdentifierReference (partitionSpec)?
|
| KW_ALTER KW_TABLE tableName (partitionSpec)?
|
||||||
KW_SET KW_SERDEPROPERTIES propertyList
|
KW_SET KW_SERDEPROPERTIES propertyList
|
||||||
| KW_ALTER (KW_TABLE | KW_VIEW) (tableIdentifierReference | viewIdentifierReference) KW_ADD (KW_IF KW_NOT KW_EXISTS)?
|
| KW_ALTER (KW_TABLE | KW_VIEW) (tableName | viewName) KW_ADD (ifNotExists)?
|
||||||
partitionSpecLocation+
|
partitionSpecLocation+
|
||||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
| KW_ALTER KW_TABLE tableName
|
||||||
partitionSpec KW_RENAME KW_TO partitionSpec
|
partitionSpec KW_RENAME KW_TO partitionSpec
|
||||||
| KW_ALTER (KW_TABLE | KW_VIEW) (tableIdentifierReference | viewIdentifierReference)
|
| KW_ALTER (KW_TABLE | KW_VIEW) (tableName | viewName)
|
||||||
KW_DROP (KW_IF KW_EXISTS)? partitionSpec (COMMA partitionSpec)* KW_PURGE?
|
KW_DROP (ifExists)? partitionSpec (COMMA partitionSpec)* KW_PURGE?
|
||||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
| KW_ALTER KW_TABLE tableName
|
||||||
(partitionSpec)? KW_SET locationSpec
|
(partitionSpec)? KW_SET locationSpec
|
||||||
| KW_ALTER KW_TABLE tableIdentifierReference KW_RECOVER KW_PARTITIONS
|
| KW_ALTER KW_TABLE tableName KW_RECOVER KW_PARTITIONS
|
||||||
| KW_DROP KW_TABLE (KW_IF KW_EXISTS)? tableIdentifierReference KW_PURGE?
|
| KW_DROP KW_TABLE (ifExists)? tableName KW_PURGE?
|
||||||
| KW_DROP KW_VIEW (KW_IF KW_EXISTS)? viewIdentifierReference
|
| KW_DROP KW_VIEW (ifExists)? viewName
|
||||||
| KW_CREATE (KW_OR KW_REPLACE)? (KW_GLOBAL? KW_TEMPORARY)?
|
| KW_CREATE (KW_OR KW_REPLACE)? (KW_GLOBAL? KW_TEMPORARY)?
|
||||||
KW_VIEW (KW_IF KW_NOT KW_EXISTS)? viewIdentifierReference
|
KW_VIEW (ifNotExists)? viewNameCreate
|
||||||
identifierCommentList?
|
identifierCommentList?
|
||||||
(commentSpec |
|
(commentSpec |
|
||||||
(KW_PARTITIONED KW_ON identifierList) |
|
(KW_PARTITIONED KW_ON identifierList) |
|
||||||
(KW_TBLPROPERTIES propertyList))*
|
(KW_TBLPROPERTIES propertyList))*
|
||||||
KW_AS query
|
KW_AS query
|
||||||
| KW_CREATE (KW_OR KW_REPLACE)? KW_GLOBAL? KW_TEMPORARY KW_VIEW
|
| KW_CREATE (KW_OR KW_REPLACE)? KW_GLOBAL? KW_TEMPORARY KW_VIEW
|
||||||
tableIdentifier (LEFT_PAREN colTypeList RIGHT_PAREN)? tableProvider
|
viewNameCreate (LEFT_PAREN colTypeList RIGHT_PAREN)? tableProvider
|
||||||
(KW_OPTIONS propertyList)?
|
(KW_OPTIONS propertyList)?
|
||||||
| KW_ALTER KW_VIEW viewIdentifierReference KW_AS? query
|
| KW_ALTER KW_VIEW viewName KW_AS? query
|
||||||
| KW_CREATE (KW_OR KW_REPLACE)? KW_TEMPORARY? KW_FUNCTION (KW_IF KW_NOT KW_EXISTS)?
|
| KW_CREATE (KW_OR KW_REPLACE)? KW_TEMPORARY? KW_FUNCTION (ifNotExists)?
|
||||||
functionIdentifierReference KW_AS className=stringLit
|
functionNameCreate KW_AS className=stringLit
|
||||||
(KW_USING resource (COMMA resource)*)?
|
(KW_USING resource (COMMA resource)*)?
|
||||||
| KW_DROP KW_TEMPORARY? KW_FUNCTION (KW_IF KW_EXISTS)? functionIdentifierReference
|
| KW_DROP KW_TEMPORARY? KW_FUNCTION (ifExists)? functionName
|
||||||
| KW_DECLARE (KW_OR KW_REPLACE)? KW_VARIABLE?
|
| KW_DECLARE (KW_OR KW_REPLACE)? KW_VARIABLE?
|
||||||
functionIdentifierReference dataType? variableDefaultExpression?
|
functionName dataType? variableDefaultExpression?
|
||||||
| KW_DROP KW_TEMPORARY KW_VARIABLE (KW_IF KW_EXISTS)? identifierReference
|
| KW_DROP KW_TEMPORARY KW_VARIABLE (ifExists)? (tableName | viewName | functionName)
|
||||||
| KW_EXPLAIN (KW_LOGICAL | KW_FORMATTED | KW_EXTENDED | KW_CODEGEN | KW_COST)?
|
| KW_EXPLAIN (KW_LOGICAL | KW_FORMATTED | KW_EXTENDED | KW_CODEGEN | KW_COST)?
|
||||||
statement
|
statement
|
||||||
| KW_SHOW KW_TABLES ((KW_FROM | KW_IN) tableIdentifierReference)?
|
| KW_SHOW KW_TABLES ((KW_FROM | KW_IN) dbSchemaName)?
|
||||||
(KW_LIKE? pattern=stringLit)?
|
(KW_LIKE? pattern=stringLit)?
|
||||||
| KW_SHOW KW_TABLE KW_EXTENDED ((KW_FROM | KW_IN) ns=tableIdentifierReference)?
|
| KW_SHOW KW_TABLE KW_EXTENDED ((KW_FROM | KW_IN) ns=dbSchemaName)?
|
||||||
KW_LIKE pattern=stringLit partitionSpec?
|
KW_LIKE pattern=stringLit partitionSpec?
|
||||||
| KW_SHOW KW_TBLPROPERTIES table=tableIdentifierReference
|
| KW_SHOW KW_TBLPROPERTIES table=tableName
|
||||||
(LEFT_PAREN key=propertyKey RIGHT_PAREN)?
|
(LEFT_PAREN key=propertyKey RIGHT_PAREN)?
|
||||||
| KW_SHOW KW_COLUMNS (KW_FROM | KW_IN) table=tableIdentifierReference
|
| KW_SHOW KW_COLUMNS (KW_FROM | KW_IN) table=tableName
|
||||||
((KW_FROM | KW_IN) multipartIdentifier)?
|
((KW_FROM | KW_IN) multipartIdentifier)?
|
||||||
| KW_SHOW KW_VIEWS ((KW_FROM | KW_IN) viewIdentifierReference)?
|
| KW_SHOW KW_VIEWS ((KW_FROM | KW_IN) dbSchemaName)?
|
||||||
(KW_LIKE? pattern=stringLit)?
|
(KW_LIKE? pattern=stringLit)?
|
||||||
| KW_SHOW KW_PARTITIONS identifierReference partitionSpec?
|
| KW_SHOW KW_PARTITIONS tableName partitionSpec?
|
||||||
| KW_SHOW identifier? KW_FUNCTIONS ((KW_FROM | KW_IN) ns=tableIdentifierReference)?
|
| KW_SHOW functionKind? KW_FUNCTIONS ((KW_FROM | KW_IN) ns=dbSchemaName)?
|
||||||
(KW_LIKE? (legacy=multipartIdentifier | pattern=stringLit))?
|
(KW_LIKE? (legacy=multipartIdentifier | pattern=stringLit))?
|
||||||
| KW_SHOW KW_CREATE KW_TABLE tableIdentifierReference (KW_AS KW_SERDE)?
|
| KW_SHOW KW_CREATE KW_TABLE tableName (KW_AS KW_SERDE)?
|
||||||
| KW_SHOW KW_CURRENT namespace
|
| KW_SHOW KW_CURRENT dbSchema
|
||||||
| KW_SHOW KW_CATALOGS (KW_LIKE? pattern=stringLit)?
|
| KW_SHOW KW_CATALOGS (KW_LIKE? pattern=stringLit)?
|
||||||
| (KW_DESC | KW_DESCRIBE) KW_FUNCTION KW_EXTENDED? describeFuncName
|
| (KW_DESC | KW_DESCRIBE) KW_FUNCTION KW_EXTENDED? describeFuncName
|
||||||
| (KW_DESC | KW_DESCRIBE) namespace KW_EXTENDED?
|
| (KW_DESC | KW_DESCRIBE) KW_DATABASE KW_EXTENDED? dbSchemaName
|
||||||
namespaceIdentifierReference
|
|
||||||
| (KW_DESC | KW_DESCRIBE) KW_TABLE? option=(KW_EXTENDED | KW_FORMATTED)?
|
| (KW_DESC | KW_DESCRIBE) KW_TABLE? option=(KW_EXTENDED | KW_FORMATTED)?
|
||||||
tableIdentifierReference partitionSpec? describeColName?
|
tableName partitionSpec? describeColName?
|
||||||
| (KW_DESC | KW_DESCRIBE) KW_QUERY? query
|
| (KW_DESC | KW_DESCRIBE) KW_QUERY? query
|
||||||
| KW_COMMENT KW_ON namespace namespaceIdentifierReference KW_IS
|
| KW_COMMENT KW_ON dbSchema dbSchemaName KW_IS
|
||||||
comment
|
comment
|
||||||
| KW_COMMENT KW_ON KW_TABLE tableIdentifierReference KW_IS comment
|
| KW_COMMENT KW_ON KW_TABLE tableName KW_IS comment
|
||||||
| KW_REFRESH KW_TABLE tableIdentifierReference
|
| KW_REFRESH KW_TABLE tableName
|
||||||
| KW_REFRESH KW_FUNCTION functionIdentifierReference
|
| KW_REFRESH KW_FUNCTION functionName
|
||||||
| KW_REFRESH (stringLit | .*?)
|
| KW_REFRESH (stringLit | .*?)
|
||||||
| KW_CACHE KW_LAZY? KW_TABLE tableIdentifierReference
|
| KW_CACHE KW_LAZY? KW_TABLE tableName
|
||||||
(KW_OPTIONS options=propertyList)? (KW_AS? query)?
|
(KW_OPTIONS options=propertyList)? (KW_AS? query)?
|
||||||
| KW_UNCACHE KW_TABLE (KW_IF KW_EXISTS)? tableIdentifierReference
|
| KW_UNCACHE KW_TABLE (ifExists)? tableName
|
||||||
| KW_CLEAR KW_CACHE
|
| KW_CLEAR KW_CACHE
|
||||||
| KW_LOAD KW_DATA KW_LOCAL? KW_INPATH path=stringLit KW_OVERWRITE? KW_INTO KW_TABLE
|
| KW_LOAD KW_DATA KW_LOCAL? KW_INPATH path=stringLit KW_OVERWRITE? KW_INTO KW_TABLE
|
||||||
tableIdentifierReference partitionSpec?
|
tableName partitionSpec?
|
||||||
| KW_TRUNCATE KW_TABLE tableIdentifierReference partitionSpec?
|
| KW_TRUNCATE KW_TABLE tableName partitionSpec?
|
||||||
| (KW_MSCK)? KW_REPAIR KW_TABLE tableIdentifierReference
|
| (KW_MSCK)? KW_REPAIR KW_TABLE tableName
|
||||||
(option=(KW_ADD|KW_DROP|KW_SYNC) KW_PARTITIONS)?
|
(option=(KW_ADD|KW_DROP|KW_SYNC) KW_PARTITIONS)?
|
||||||
| op=(KW_ADD | KW_LIST) identifier .*?
|
| op=(KW_ADD | KW_LIST) identifier .*?
|
||||||
| KW_SET KW_ROLE .*?
|
| KW_SET KW_ROLE .*?
|
||||||
@ -211,11 +205,11 @@ statement
|
|||||||
| KW_SET .*?
|
| KW_SET .*?
|
||||||
| KW_RESET configKey
|
| KW_RESET configKey
|
||||||
| KW_RESET .*?
|
| KW_RESET .*?
|
||||||
| KW_CREATE KW_INDEX (KW_IF KW_NOT KW_EXISTS)? identifier KW_ON KW_TABLE?
|
| KW_CREATE KW_INDEX (ifNotExists)? identifier KW_ON KW_TABLE?
|
||||||
tableIdentifierReference (KW_USING indexType=identifier)?
|
tableName (KW_USING indexType=identifier)?
|
||||||
LEFT_PAREN multipartIdentifierPropertyList RIGHT_PAREN
|
LEFT_PAREN multipartIdentifierPropertyList RIGHT_PAREN
|
||||||
(KW_OPTIONS options=propertyList)?
|
(KW_OPTIONS options=propertyList)?
|
||||||
| KW_DROP KW_INDEX (KW_IF KW_EXISTS)? identifier KW_ON KW_TABLE? tableIdentifierReference
|
| KW_DROP KW_INDEX (ifExists)? identifier KW_ON KW_TABLE? tableName
|
||||||
| unsupportedHiveNativeCommands .*?
|
| unsupportedHiveNativeCommands .*?
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -258,21 +252,21 @@ unsupportedHiveNativeCommands
|
|||||||
| kw1=KW_UNLOCK kw2=KW_DATABASE
|
| kw1=KW_UNLOCK kw2=KW_DATABASE
|
||||||
| kw1=KW_CREATE kw2=KW_TEMPORARY kw3=KW_MACRO
|
| kw1=KW_CREATE kw2=KW_TEMPORARY kw3=KW_MACRO
|
||||||
| kw1=KW_DROP kw2=KW_TEMPORARY kw3=KW_MACRO
|
| kw1=KW_DROP kw2=KW_TEMPORARY kw3=KW_MACRO
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_NOT kw4=KW_CLUSTERED
|
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_NOT kw4=KW_CLUSTERED
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_CLUSTERED kw4=KW_BY
|
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_CLUSTERED kw4=KW_BY
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_NOT kw4=KW_SORTED
|
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_NOT kw4=KW_SORTED
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_SKEWED kw4=KW_BY
|
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_SKEWED kw4=KW_BY
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_NOT kw4=KW_SKEWED
|
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_NOT kw4=KW_SKEWED
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_NOT kw4=KW_STORED kw5=KW_AS kw6=KW_DIRECTORIES
|
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_NOT kw4=KW_STORED kw5=KW_AS kw6=KW_DIRECTORIES
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_SET kw4=KW_SKEWED kw5=KW_LOCATION
|
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_SET kw4=KW_SKEWED kw5=KW_LOCATION
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_EXCHANGE kw4=KW_PARTITION
|
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_EXCHANGE kw4=KW_PARTITION
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_ARCHIVE kw4=KW_PARTITION
|
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_ARCHIVE kw4=KW_PARTITION
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_UNARCHIVE kw4=KW_PARTITION
|
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_UNARCHIVE kw4=KW_PARTITION
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_TOUCH
|
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_TOUCH
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier partitionSpec? kw3=KW_COMPACT
|
| kw1=KW_ALTER kw2=KW_TABLE tableName partitionSpec? kw3=KW_COMPACT
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier partitionSpec? kw3=KW_CONCATENATE
|
| kw1=KW_ALTER kw2=KW_TABLE tableName partitionSpec? kw3=KW_CONCATENATE
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier partitionSpec? kw3=KW_SET kw4=KW_FILEFORMAT
|
| kw1=KW_ALTER kw2=KW_TABLE tableName partitionSpec? kw3=KW_SET kw4=KW_FILEFORMAT
|
||||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier partitionSpec? kw3=KW_REPLACE kw4=KW_COLUMNS
|
| kw1=KW_ALTER kw2=KW_TABLE tableName partitionSpec? kw3=KW_REPLACE kw4=KW_COLUMNS
|
||||||
| kw1=KW_START kw2=KW_TRANSACTION
|
| kw1=KW_START kw2=KW_TRANSACTION
|
||||||
| kw1=KW_COMMIT
|
| kw1=KW_COMMIT
|
||||||
| kw1=KW_ROLLBACK
|
| kw1=KW_ROLLBACK
|
||||||
@ -280,11 +274,11 @@ unsupportedHiveNativeCommands
|
|||||||
;
|
;
|
||||||
|
|
||||||
createTableHeader
|
createTableHeader
|
||||||
: KW_CREATE KW_TEMPORARY? KW_EXTERNAL? KW_TABLE (KW_IF KW_NOT KW_EXISTS)? tableIdentifierReference
|
: KW_CREATE KW_TEMPORARY? KW_EXTERNAL? KW_TABLE (ifNotExists)? tableNameCreate
|
||||||
;
|
;
|
||||||
|
|
||||||
replaceTableHeader
|
replaceTableHeader
|
||||||
: (KW_CREATE KW_OR)? KW_REPLACE KW_TABLE tableIdentifierReference
|
: (KW_CREATE KW_OR)? KW_REPLACE KW_TABLE tableNameCreate
|
||||||
;
|
;
|
||||||
|
|
||||||
bucketSpec
|
bucketSpec
|
||||||
@ -312,9 +306,9 @@ query
|
|||||||
;
|
;
|
||||||
|
|
||||||
insertInto
|
insertInto
|
||||||
: KW_INSERT KW_OVERWRITE KW_TABLE? tableIdentifierReference (partitionSpec (KW_IF KW_NOT KW_EXISTS)?)? ((KW_BY KW_NAME) | identifierList)?
|
: KW_INSERT KW_OVERWRITE KW_TABLE? tableName (partitionSpec (ifNotExists)?)? ((KW_BY KW_NAME) | identifierList)?
|
||||||
| KW_INSERT KW_INTO KW_TABLE? tableIdentifierReference partitionSpec? (KW_IF KW_NOT KW_EXISTS)? ((KW_BY KW_NAME) | identifierList)?
|
| KW_INSERT KW_INTO KW_TABLE? tableName partitionSpec? (ifNotExists)? ((KW_BY KW_NAME) | identifierList)?
|
||||||
| KW_INSERT KW_INTO KW_TABLE? tableIdentifierReference KW_REPLACE whereClause
|
| KW_INSERT KW_INTO KW_TABLE? tableName KW_REPLACE whereClause
|
||||||
| KW_INSERT KW_OVERWRITE KW_LOCAL? KW_DIRECTORY path=stringLit rowFormat? createFileFormat?
|
| KW_INSERT KW_OVERWRITE KW_LOCAL? KW_DIRECTORY path=stringLit rowFormat? createFileFormat?
|
||||||
| KW_INSERT KW_OVERWRITE KW_LOCAL? KW_DIRECTORY (path=stringLit)? tableProvider (KW_OPTIONS options=propertyList)?
|
| KW_INSERT KW_OVERWRITE KW_LOCAL? KW_DIRECTORY (path=stringLit)? tableProvider (KW_OPTIONS options=propertyList)?
|
||||||
;
|
;
|
||||||
@ -332,13 +326,13 @@ partitionVal
|
|||||||
| identifier EQ KW_DEFAULT
|
| identifier EQ KW_DEFAULT
|
||||||
;
|
;
|
||||||
|
|
||||||
namespace
|
dbSchema
|
||||||
: KW_NAMESPACE
|
: KW_NAMESPACE
|
||||||
| KW_DATABASE
|
| KW_DATABASE
|
||||||
| KW_SCHEMA
|
| KW_SCHEMA
|
||||||
;
|
;
|
||||||
|
|
||||||
namespaces
|
dbSchemas
|
||||||
: KW_NAMESPACES
|
: KW_NAMESPACES
|
||||||
| KW_DATABASES
|
| KW_DATABASES
|
||||||
| KW_SCHEMAS
|
| KW_SCHEMAS
|
||||||
@ -437,9 +431,9 @@ resource
|
|||||||
dmlStatementNoWith
|
dmlStatementNoWith
|
||||||
: insertInto query
|
: insertInto query
|
||||||
| fromClause multiInsertQueryBody+
|
| fromClause multiInsertQueryBody+
|
||||||
| KW_DELETE KW_FROM identifierReference tableAlias whereClause?
|
| KW_DELETE KW_FROM tableName tableAlias whereClause?
|
||||||
| KW_UPDATE identifierReference tableAlias setClause whereClause?
|
| KW_UPDATE tableName tableAlias setClause whereClause?
|
||||||
| KW_MERGE KW_INTO target=identifierReference targetAlias=tableAlias
|
| KW_MERGE KW_INTO target=tableName targetAlias=tableAlias
|
||||||
KW_USING (source=identifierReference |
|
KW_USING (source=identifierReference |
|
||||||
LEFT_PAREN sourceQuery=query RIGHT_PAREN) sourceAlias=tableAlias
|
LEFT_PAREN sourceQuery=query RIGHT_PAREN) sourceAlias=tableAlias
|
||||||
KW_ON mergeCondition=booleanExpression
|
KW_ON mergeCondition=booleanExpression
|
||||||
@ -448,6 +442,13 @@ dmlStatementNoWith
|
|||||||
notMatchedBySourceClause*
|
notMatchedBySourceClause*
|
||||||
;
|
;
|
||||||
|
|
||||||
|
dbSchemaName: identifierReference;
|
||||||
|
dbSchemaNameCreate: identifierReference;
|
||||||
|
tableNameCreate : tableIdentifier;
|
||||||
|
tableName : tableIdentifier;
|
||||||
|
viewNameCreate : viewIdentifier;
|
||||||
|
viewName : viewIdentifier;
|
||||||
|
|
||||||
identifierReference
|
identifierReference
|
||||||
: KW_IDENTIFIER_KW LEFT_PAREN expression RIGHT_PAREN
|
: KW_IDENTIFIER_KW LEFT_PAREN expression RIGHT_PAREN
|
||||||
| multipartIdentifier
|
| multipartIdentifier
|
||||||
@ -480,7 +481,7 @@ queryTerm
|
|||||||
queryPrimary
|
queryPrimary
|
||||||
: querySpecification
|
: querySpecification
|
||||||
| fromStatement
|
| fromStatement
|
||||||
| KW_TABLE tableIdentifierReference
|
| KW_TABLE tableName
|
||||||
| inlineTable
|
| inlineTable
|
||||||
| LEFT_PAREN query RIGHT_PAREN
|
| LEFT_PAREN query RIGHT_PAREN
|
||||||
;
|
;
|
||||||
@ -600,6 +601,10 @@ fromClause
|
|||||||
: KW_FROM relation (COMMA relation)* lateralView* pivotClause? unpivotClause?
|
: KW_FROM relation (COMMA relation)* lateralView* pivotClause? unpivotClause?
|
||||||
;
|
;
|
||||||
|
|
||||||
|
functionKind
|
||||||
|
: KW_USER | KW_SYSTEM | KW_ALL
|
||||||
|
;
|
||||||
|
|
||||||
temporalClause
|
temporalClause
|
||||||
: KW_FOR? (KW_SYSTEM_VERSION | KW_VERSION) KW_AS KW_OF version
|
: KW_FOR? (KW_SYSTEM_VERSION | KW_VERSION) KW_AS KW_OF version
|
||||||
| KW_FOR? (KW_SYSTEM_TIME | KW_TIMESTAMP) KW_AS KW_OF timestamp=valueExpression
|
| KW_FOR? (KW_SYSTEM_TIME | KW_TIMESTAMP) KW_AS KW_OF timestamp=valueExpression
|
||||||
@ -695,8 +700,14 @@ unpivotAlias
|
|||||||
: KW_AS? identifier
|
: KW_AS? identifier
|
||||||
;
|
;
|
||||||
|
|
||||||
|
ifNotExists
|
||||||
|
: KW_IF KW_NOT KW_EXISTS;
|
||||||
|
|
||||||
|
ifExists
|
||||||
|
: KW_IF KW_EXISTS;
|
||||||
|
|
||||||
lateralView
|
lateralView
|
||||||
: KW_LATERAL KW_VIEW (KW_OUTER)? qualifiedName LEFT_PAREN (expression (COMMA expression)*)? RIGHT_PAREN tblName=identifier (KW_AS? colName+=identifier (COMMA colName+=identifier)*)?
|
: KW_LATERAL KW_VIEW (KW_OUTER)? viewName LEFT_PAREN (expression (COMMA expression)*)? RIGHT_PAREN tableAlias (KW_AS? colName+=identifier (COMMA colName+=identifier)*)?
|
||||||
;
|
;
|
||||||
|
|
||||||
setQuantifier
|
setQuantifier
|
||||||
@ -706,6 +717,7 @@ setQuantifier
|
|||||||
|
|
||||||
relation
|
relation
|
||||||
: KW_LATERAL? relationPrimary relationExtension*
|
: KW_LATERAL? relationPrimary relationExtension*
|
||||||
|
| tableName
|
||||||
;
|
;
|
||||||
|
|
||||||
relationExtension
|
relationExtension
|
||||||
@ -784,8 +796,8 @@ inlineTable
|
|||||||
;
|
;
|
||||||
|
|
||||||
functionTableSubqueryArgument
|
functionTableSubqueryArgument
|
||||||
: KW_TABLE tableIdentifierReference tableArgumentPartitioning?
|
: KW_TABLE tableName tableArgumentPartitioning?
|
||||||
| KW_TABLE LEFT_PAREN tableIdentifierReference RIGHT_PAREN tableArgumentPartitioning?
|
| KW_TABLE LEFT_PAREN tableName RIGHT_PAREN tableArgumentPartitioning?
|
||||||
| KW_TABLE LEFT_PAREN query RIGHT_PAREN tableArgumentPartitioning?
|
| KW_TABLE LEFT_PAREN query RIGHT_PAREN tableArgumentPartitioning?
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -814,7 +826,7 @@ functionTableArgument
|
|||||||
;
|
;
|
||||||
|
|
||||||
functionTable
|
functionTable
|
||||||
: funcName=functionName LEFT_PAREN
|
: functionName LEFT_PAREN
|
||||||
(functionTableArgument (COMMA functionTableArgument)*)?
|
(functionTableArgument (COMMA functionTableArgument)*)?
|
||||||
RIGHT_PAREN tableAlias
|
RIGHT_PAREN tableAlias
|
||||||
;
|
;
|
||||||
@ -853,8 +865,8 @@ tableIdentifier
|
|||||||
: (db=errorCapturingIdentifier DOT)? table=errorCapturingIdentifier
|
: (db=errorCapturingIdentifier DOT)? table=errorCapturingIdentifier
|
||||||
;
|
;
|
||||||
|
|
||||||
functionIdentifier
|
viewIdentifier
|
||||||
: (db=errorCapturingIdentifier DOT)? function=errorCapturingIdentifier
|
: (db=errorCapturingIdentifier DOT)? view=errorCapturingIdentifier
|
||||||
;
|
;
|
||||||
|
|
||||||
namedExpression
|
namedExpression
|
||||||
@ -903,7 +915,7 @@ expressionSeq
|
|||||||
;
|
;
|
||||||
|
|
||||||
booleanExpression
|
booleanExpression
|
||||||
: KW_NOT booleanExpression
|
: (KW_NOT | NOT) booleanExpression
|
||||||
| KW_EXISTS LEFT_PAREN query RIGHT_PAREN
|
| KW_EXISTS LEFT_PAREN query RIGHT_PAREN
|
||||||
| valueExpression predicate?
|
| valueExpression predicate?
|
||||||
| left=booleanExpression operator=KW_AND right=booleanExpression
|
| left=booleanExpression operator=KW_AND right=booleanExpression
|
||||||
@ -914,7 +926,7 @@ predicate
|
|||||||
: KW_NOT? kind=KW_BETWEEN lower=valueExpression KW_AND upper=valueExpression
|
: KW_NOT? kind=KW_BETWEEN lower=valueExpression KW_AND upper=valueExpression
|
||||||
| KW_NOT? kind=KW_IN LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN
|
| KW_NOT? kind=KW_IN LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN
|
||||||
| KW_NOT? kind=KW_IN LEFT_PAREN query RIGHT_PAREN
|
| KW_NOT? kind=KW_IN LEFT_PAREN query RIGHT_PAREN
|
||||||
| KW_NOT? kind=KW_RLIKE pattern=valueExpression
|
| KW_NOT? kind=(KW_RLIKE | KW_REGEXP) pattern=valueExpression
|
||||||
| KW_NOT? kind=(KW_LIKE | KW_ILIKE) quantifier=(KW_ANY | KW_SOME | KW_ALL) (LEFT_PAREN RIGHT_PAREN | LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN)
|
| KW_NOT? kind=(KW_LIKE | KW_ILIKE) quantifier=(KW_ANY | KW_SOME | KW_ALL) (LEFT_PAREN RIGHT_PAREN | LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN)
|
||||||
| KW_NOT? kind=(KW_LIKE | KW_ILIKE) pattern=valueExpression (KW_ESCAPE escapeChar=stringLit)?
|
| KW_NOT? kind=(KW_LIKE | KW_ILIKE) pattern=valueExpression (KW_ESCAPE escapeChar=stringLit)?
|
||||||
| KW_IS KW_NOT? kind=KW_NULL
|
| KW_IS KW_NOT? kind=KW_NULL
|
||||||
@ -1195,6 +1207,10 @@ functionName
|
|||||||
| KW_RIGHT
|
| KW_RIGHT
|
||||||
;
|
;
|
||||||
|
|
||||||
|
functionNameCreate
|
||||||
|
: qualifiedName
|
||||||
|
;
|
||||||
|
|
||||||
qualifiedName
|
qualifiedName
|
||||||
: identifier (DOT identifier)*
|
: identifier (DOT identifier)*
|
||||||
;
|
;
|
||||||
@ -1462,6 +1478,7 @@ ansiNonReserved
|
|||||||
| KW_RESTRICT
|
| KW_RESTRICT
|
||||||
| KW_REVOKE
|
| KW_REVOKE
|
||||||
| KW_RLIKE
|
| KW_RLIKE
|
||||||
|
| KW_REGEXP
|
||||||
| KW_ROLE
|
| KW_ROLE
|
||||||
| KW_ROLES
|
| KW_ROLES
|
||||||
| KW_ROLLBACK
|
| KW_ROLLBACK
|
||||||
@ -1496,6 +1513,7 @@ ansiNonReserved
|
|||||||
| KW_SUBSTR
|
| KW_SUBSTR
|
||||||
| KW_SUBSTRING
|
| KW_SUBSTRING
|
||||||
| KW_SYNC
|
| KW_SYNC
|
||||||
|
| KW_SYSTEM
|
||||||
| KW_SYSTEM_TIME
|
| KW_SYSTEM_TIME
|
||||||
| KW_SYSTEM_VERSION
|
| KW_SYSTEM_VERSION
|
||||||
| KW_TABLES
|
| KW_TABLES
|
||||||
@ -1801,6 +1819,7 @@ nonReserved
|
|||||||
| KW_RESTRICT
|
| KW_RESTRICT
|
||||||
| KW_REVOKE
|
| KW_REVOKE
|
||||||
| KW_RLIKE
|
| KW_RLIKE
|
||||||
|
| KW_REGEXP
|
||||||
| KW_ROLE
|
| KW_ROLE
|
||||||
| KW_ROLES
|
| KW_ROLES
|
||||||
| KW_ROLLBACK
|
| KW_ROLLBACK
|
||||||
@ -1836,6 +1855,7 @@ nonReserved
|
|||||||
| KW_SUBSTR
|
| KW_SUBSTR
|
||||||
| KW_SUBSTRING
|
| KW_SUBSTRING
|
||||||
| KW_SYNC
|
| KW_SYNC
|
||||||
|
| KW_SYSTEM
|
||||||
| KW_SYSTEM_TIME
|
| KW_SYSTEM_TIME
|
||||||
| KW_SYSTEM_VERSION
|
| KW_SYSTEM_VERSION
|
||||||
| KW_TABLE
|
| KW_TABLE
|
||||||
|
File diff suppressed because one or more lines are too long
@ -242,144 +242,147 @@ KW_RESTRICT=241
|
|||||||
KW_REVOKE=242
|
KW_REVOKE=242
|
||||||
KW_RIGHT=243
|
KW_RIGHT=243
|
||||||
KW_RLIKE=244
|
KW_RLIKE=244
|
||||||
KW_ROLE=245
|
KW_REGEXP=245
|
||||||
KW_ROLES=246
|
KW_ROLE=246
|
||||||
KW_ROLLBACK=247
|
KW_ROLES=247
|
||||||
KW_ROLLUP=248
|
KW_ROLLBACK=248
|
||||||
KW_ROW=249
|
KW_ROLLUP=249
|
||||||
KW_ROWS=250
|
KW_ROW=250
|
||||||
KW_SECOND=251
|
KW_ROWS=251
|
||||||
KW_SECONDS=252
|
KW_SECOND=252
|
||||||
KW_SCHEMA=253
|
KW_SECONDS=253
|
||||||
KW_SCHEMAS=254
|
KW_SCHEMA=254
|
||||||
KW_SELECT=255
|
KW_SCHEMAS=255
|
||||||
KW_SEMI=256
|
KW_SELECT=256
|
||||||
KW_SEPARATED=257
|
KW_SEMI=257
|
||||||
KW_SERDE=258
|
KW_SEPARATED=258
|
||||||
KW_SERDEPROPERTIES=259
|
KW_SERDE=259
|
||||||
KW_SESSION_USER=260
|
KW_SERDEPROPERTIES=260
|
||||||
KW_SET=261
|
KW_SESSION_USER=261
|
||||||
KW_SETMINUS=262
|
KW_SET=262
|
||||||
KW_SETS=263
|
KW_SETMINUS=263
|
||||||
KW_SHORT=264
|
KW_SETS=264
|
||||||
KW_SHOW=265
|
KW_SHORT=265
|
||||||
KW_SINGLE=266
|
KW_SHOW=266
|
||||||
KW_SKEWED=267
|
KW_SINGLE=267
|
||||||
KW_SMALLINT=268
|
KW_SKEWED=268
|
||||||
KW_SOME=269
|
KW_SMALLINT=269
|
||||||
KW_SORT=270
|
KW_SOME=270
|
||||||
KW_SORTED=271
|
KW_SORT=271
|
||||||
KW_SOURCE=272
|
KW_SORTED=272
|
||||||
KW_START=273
|
KW_SOURCE=273
|
||||||
KW_STATISTICS=274
|
KW_START=274
|
||||||
KW_STORED=275
|
KW_STATISTICS=275
|
||||||
KW_STRATIFY=276
|
KW_STORED=276
|
||||||
KW_STRING=277
|
KW_STRATIFY=277
|
||||||
KW_STRUCT=278
|
KW_STRING=278
|
||||||
KW_SUBSTR=279
|
KW_STRUCT=279
|
||||||
KW_SUBSTRING=280
|
KW_SUBSTR=280
|
||||||
KW_SYNC=281
|
KW_SUBSTRING=281
|
||||||
KW_SYSTEM_TIME=282
|
KW_SYNC=282
|
||||||
KW_SYSTEM_VERSION=283
|
KW_SYSTEM=283
|
||||||
KW_TABLE=284
|
KW_SYSTEM_TIME=284
|
||||||
KW_TABLES=285
|
KW_SYSTEM_VERSION=285
|
||||||
KW_TABLESAMPLE=286
|
KW_TABLE=286
|
||||||
KW_TARGET=287
|
KW_TABLES=287
|
||||||
KW_TBLPROPERTIES=288
|
KW_TABLESAMPLE=288
|
||||||
KW_TEMPORARY=289
|
KW_TARGET=289
|
||||||
KW_TERMINATED=290
|
KW_TBLPROPERTIES=290
|
||||||
KW_THEN=291
|
KW_TEMPORARY=291
|
||||||
KW_TIME=292
|
KW_TERMINATED=292
|
||||||
KW_TIMEDIFF=293
|
KW_THEN=293
|
||||||
KW_TIMESTAMP=294
|
KW_TIME=294
|
||||||
KW_TIMESTAMP_LTZ=295
|
KW_TIMEDIFF=295
|
||||||
KW_TIMESTAMP_NTZ=296
|
KW_TIMESTAMP=296
|
||||||
KW_TIMESTAMPADD=297
|
KW_TIMESTAMP_LTZ=297
|
||||||
KW_TIMESTAMPDIFF=298
|
KW_TIMESTAMP_NTZ=298
|
||||||
KW_TINYINT=299
|
KW_TIMESTAMPADD=299
|
||||||
KW_TO=300
|
KW_TIMESTAMPDIFF=300
|
||||||
KW_TOUCH=301
|
KW_TINYINT=301
|
||||||
KW_TRAILING=302
|
KW_TO=302
|
||||||
KW_TRANSACTION=303
|
KW_TOUCH=303
|
||||||
KW_TRANSACTIONS=304
|
KW_TRAILING=304
|
||||||
KW_TRANSFORM=305
|
KW_TRANSACTION=305
|
||||||
KW_TRIM=306
|
KW_TRANSACTIONS=306
|
||||||
KW_TRUE=307
|
KW_TRANSFORM=307
|
||||||
KW_TRUNCATE=308
|
KW_TRIM=308
|
||||||
KW_TRY_CAST=309
|
KW_TRUE=309
|
||||||
KW_TYPE=310
|
KW_TRUNCATE=310
|
||||||
KW_UNARCHIVE=311
|
KW_TRY_CAST=311
|
||||||
KW_UNBOUNDED=312
|
KW_TYPE=312
|
||||||
KW_UNCACHE=313
|
KW_UNARCHIVE=313
|
||||||
KW_UNION=314
|
KW_UNBOUNDED=314
|
||||||
KW_UNIQUE=315
|
KW_UNCACHE=315
|
||||||
KW_UNKNOWN=316
|
KW_UNION=316
|
||||||
KW_UNLOCK=317
|
KW_UNIQUE=317
|
||||||
KW_UNPIVOT=318
|
KW_UNKNOWN=318
|
||||||
KW_UNSET=319
|
KW_UNLOCK=319
|
||||||
KW_UPDATE=320
|
KW_UNPIVOT=320
|
||||||
KW_USE=321
|
KW_UNSET=321
|
||||||
KW_USER=322
|
KW_UPDATE=322
|
||||||
KW_USING=323
|
KW_USE=323
|
||||||
KW_VALUES=324
|
KW_USER=324
|
||||||
KW_VARCHAR=325
|
KW_USING=325
|
||||||
KW_VAR=326
|
KW_VALUES=326
|
||||||
KW_VARIABLE=327
|
KW_VARCHAR=327
|
||||||
KW_VERSION=328
|
KW_VAR=328
|
||||||
KW_VIEW=329
|
KW_VARIABLE=329
|
||||||
KW_VIEWS=330
|
KW_VERSION=330
|
||||||
KW_VOID=331
|
KW_VIEW=331
|
||||||
KW_WEEK=332
|
KW_VIEWS=332
|
||||||
KW_WEEKS=333
|
KW_VOID=333
|
||||||
KW_WHEN=334
|
KW_WEEK=334
|
||||||
KW_WHERE=335
|
KW_WEEKS=335
|
||||||
KW_WINDOW=336
|
KW_WHEN=336
|
||||||
KW_WITH=337
|
KW_WHERE=337
|
||||||
KW_WITHIN=338
|
KW_WINDOW=338
|
||||||
KW_YEAR=339
|
KW_WITH=339
|
||||||
KW_YEARS=340
|
KW_WITHIN=340
|
||||||
KW_ZONE=341
|
KW_YEAR=341
|
||||||
EQ=342
|
KW_YEARS=342
|
||||||
NSEQ=343
|
KW_ZONE=343
|
||||||
NEQ=344
|
EQ=344
|
||||||
NEQJ=345
|
NSEQ=345
|
||||||
LT=346
|
NEQ=346
|
||||||
LTE=347
|
NEQJ=347
|
||||||
GT=348
|
LT=348
|
||||||
GTE=349
|
LTE=349
|
||||||
PLUS=350
|
GT=350
|
||||||
MINUS=351
|
GTE=351
|
||||||
ASTERISK=352
|
NOT=352
|
||||||
SLASH=353
|
PLUS=353
|
||||||
PERCENT=354
|
MINUS=354
|
||||||
TILDE=355
|
ASTERISK=355
|
||||||
AMPERSAND=356
|
SLASH=356
|
||||||
PIPE=357
|
PERCENT=357
|
||||||
CONCAT_PIPE=358
|
TILDE=358
|
||||||
HAT=359
|
AMPERSAND=359
|
||||||
COLON=360
|
PIPE=360
|
||||||
ARROW=361
|
CONCAT_PIPE=361
|
||||||
FAT_ARROW=362
|
HAT=362
|
||||||
HENT_START=363
|
COLON=363
|
||||||
HENT_END=364
|
ARROW=364
|
||||||
QUESTION=365
|
FAT_ARROW=365
|
||||||
STRING_LITERAL=366
|
HENT_START=366
|
||||||
DOUBLEQUOTED_STRING=367
|
HENT_END=367
|
||||||
BIGINT_LITERAL=368
|
QUESTION=368
|
||||||
SMALLINT_LITERAL=369
|
STRING_LITERAL=369
|
||||||
TINYINT_LITERAL=370
|
DOUBLEQUOTED_STRING=370
|
||||||
INTEGER_VALUE=371
|
BIGINT_LITERAL=371
|
||||||
EXPONENT_VALUE=372
|
SMALLINT_LITERAL=372
|
||||||
DECIMAL_VALUE=373
|
TINYINT_LITERAL=373
|
||||||
FLOAT_LITERAL=374
|
INTEGER_VALUE=374
|
||||||
DOUBLE_LITERAL=375
|
EXPONENT_VALUE=375
|
||||||
BIGDECIMAL_LITERAL=376
|
DECIMAL_VALUE=376
|
||||||
IDENTIFIER=377
|
FLOAT_LITERAL=377
|
||||||
BACKQUOTED_IDENTIFIER=378
|
DOUBLE_LITERAL=378
|
||||||
SIMPLE_COMMENT=379
|
BIGDECIMAL_LITERAL=379
|
||||||
BRACKETED_COMMENT=380
|
IDENTIFIER=380
|
||||||
WS=381
|
BACKQUOTED_IDENTIFIER=381
|
||||||
UNRECOGNIZED=382
|
SIMPLE_COMMENT=382
|
||||||
|
BRACKETED_COMMENT=383
|
||||||
|
WS=384
|
||||||
|
UNRECOGNIZED=385
|
||||||
';'=1
|
';'=1
|
||||||
'('=2
|
'('=2
|
||||||
')'=3
|
')'=3
|
||||||
@ -571,6 +574,7 @@ UNRECOGNIZED=382
|
|||||||
'NANOSECONDS'=189
|
'NANOSECONDS'=189
|
||||||
'NATURAL'=190
|
'NATURAL'=190
|
||||||
'NO'=191
|
'NO'=191
|
||||||
|
'NOT'=192
|
||||||
'NULL'=193
|
'NULL'=193
|
||||||
'NULLS'=194
|
'NULLS'=194
|
||||||
'NUMERIC'=195
|
'NUMERIC'=195
|
||||||
@ -622,120 +626,125 @@ UNRECOGNIZED=382
|
|||||||
'RESTRICT'=241
|
'RESTRICT'=241
|
||||||
'REVOKE'=242
|
'REVOKE'=242
|
||||||
'RIGHT'=243
|
'RIGHT'=243
|
||||||
'ROLE'=245
|
'RLIKE'=244
|
||||||
'ROLES'=246
|
'REGEXP'=245
|
||||||
'ROLLBACK'=247
|
'ROLE'=246
|
||||||
'ROLLUP'=248
|
'ROLES'=247
|
||||||
'ROW'=249
|
'ROLLBACK'=248
|
||||||
'ROWS'=250
|
'ROLLUP'=249
|
||||||
'SECOND'=251
|
'ROW'=250
|
||||||
'SECONDS'=252
|
'ROWS'=251
|
||||||
'SCHEMA'=253
|
'SECOND'=252
|
||||||
'SCHEMAS'=254
|
'SECONDS'=253
|
||||||
'SELECT'=255
|
'SCHEMA'=254
|
||||||
'SEMI'=256
|
'SCHEMAS'=255
|
||||||
'SEPARATED'=257
|
'SELECT'=256
|
||||||
'SERDE'=258
|
'SEMI'=257
|
||||||
'SERDEPROPERTIES'=259
|
'SEPARATED'=258
|
||||||
'SESSION_USER'=260
|
'SERDE'=259
|
||||||
'SET'=261
|
'SERDEPROPERTIES'=260
|
||||||
'MINUS'=262
|
'SESSION_USER'=261
|
||||||
'SETS'=263
|
'SET'=262
|
||||||
'SHORT'=264
|
'MINUS'=263
|
||||||
'SHOW'=265
|
'SETS'=264
|
||||||
'SINGLE'=266
|
'SHORT'=265
|
||||||
'SKEWED'=267
|
'SHOW'=266
|
||||||
'SMALLINT'=268
|
'SINGLE'=267
|
||||||
'SOME'=269
|
'SKEWED'=268
|
||||||
'SORT'=270
|
'SMALLINT'=269
|
||||||
'SORTED'=271
|
'SOME'=270
|
||||||
'SOURCE'=272
|
'SORT'=271
|
||||||
'START'=273
|
'SORTED'=272
|
||||||
'STATISTICS'=274
|
'SOURCE'=273
|
||||||
'STORED'=275
|
'START'=274
|
||||||
'STRATIFY'=276
|
'STATISTICS'=275
|
||||||
'STRING'=277
|
'STORED'=276
|
||||||
'STRUCT'=278
|
'STRATIFY'=277
|
||||||
'SUBSTR'=279
|
'STRING'=278
|
||||||
'SUBSTRING'=280
|
'STRUCT'=279
|
||||||
'SYNC'=281
|
'SUBSTR'=280
|
||||||
'SYSTEM_TIME'=282
|
'SUBSTRING'=281
|
||||||
'SYSTEM_VERSION'=283
|
'SYNC'=282
|
||||||
'TABLE'=284
|
'SYSTEM'=283
|
||||||
'TABLES'=285
|
'SYSTEM_TIME'=284
|
||||||
'TABLESAMPLE'=286
|
'SYSTEM_VERSION'=285
|
||||||
'TARGET'=287
|
'TABLE'=286
|
||||||
'TBLPROPERTIES'=288
|
'TABLES'=287
|
||||||
'TERMINATED'=290
|
'TABLESAMPLE'=288
|
||||||
'THEN'=291
|
'TARGET'=289
|
||||||
'TIME'=292
|
'TBLPROPERTIES'=290
|
||||||
'TIMEDIFF'=293
|
'TEMPORARY'=291
|
||||||
'TIMESTAMP'=294
|
'TERMINATED'=292
|
||||||
'TIMESTAMP_LTZ'=295
|
'THEN'=293
|
||||||
'TIMESTAMP_NTZ'=296
|
'TIME'=294
|
||||||
'TIMESTAMPADD'=297
|
'TIMEDIFF'=295
|
||||||
'TIMESTAMPDIFF'=298
|
'TIMESTAMP'=296
|
||||||
'TINYINT'=299
|
'TIMESTAMP_LTZ'=297
|
||||||
'TO'=300
|
'TIMESTAMP_NTZ'=298
|
||||||
'TOUCH'=301
|
'TIMESTAMPADD'=299
|
||||||
'TRAILING'=302
|
'TIMESTAMPDIFF'=300
|
||||||
'TRANSACTION'=303
|
'TINYINT'=301
|
||||||
'TRANSACTIONS'=304
|
'TO'=302
|
||||||
'TRANSFORM'=305
|
'TOUCH'=303
|
||||||
'TRIM'=306
|
'TRAILING'=304
|
||||||
'TRUE'=307
|
'TRANSACTION'=305
|
||||||
'TRUNCATE'=308
|
'TRANSACTIONS'=306
|
||||||
'TRY_CAST'=309
|
'TRANSFORM'=307
|
||||||
'TYPE'=310
|
'TRIM'=308
|
||||||
'UNARCHIVE'=311
|
'TRUE'=309
|
||||||
'UNBOUNDED'=312
|
'TRUNCATE'=310
|
||||||
'UNCACHE'=313
|
'TRY_CAST'=311
|
||||||
'UNION'=314
|
'TYPE'=312
|
||||||
'UNIQUE'=315
|
'UNARCHIVE'=313
|
||||||
'UNKNOWN'=316
|
'UNBOUNDED'=314
|
||||||
'UNLOCK'=317
|
'UNCACHE'=315
|
||||||
'UNPIVOT'=318
|
'UNION'=316
|
||||||
'UNSET'=319
|
'UNIQUE'=317
|
||||||
'UPDATE'=320
|
'UNKNOWN'=318
|
||||||
'USE'=321
|
'UNLOCK'=319
|
||||||
'USER'=322
|
'UNPIVOT'=320
|
||||||
'USING'=323
|
'UNSET'=321
|
||||||
'VALUES'=324
|
'UPDATE'=322
|
||||||
'VARCHAR'=325
|
'USE'=323
|
||||||
'VAR'=326
|
'USER'=324
|
||||||
'VARIABLE'=327
|
'USING'=325
|
||||||
'VERSION'=328
|
'VALUES'=326
|
||||||
'VIEW'=329
|
'VARCHAR'=327
|
||||||
'VIEWS'=330
|
'VAR'=328
|
||||||
'VOID'=331
|
'VARIABLE'=329
|
||||||
'WEEK'=332
|
'VERSION'=330
|
||||||
'WEEKS'=333
|
'VIEW'=331
|
||||||
'WHEN'=334
|
'VIEWS'=332
|
||||||
'WHERE'=335
|
'VOID'=333
|
||||||
'WINDOW'=336
|
'WEEK'=334
|
||||||
'WITH'=337
|
'WEEKS'=335
|
||||||
'WITHIN'=338
|
'WHEN'=336
|
||||||
'YEAR'=339
|
'WHERE'=337
|
||||||
'YEARS'=340
|
'WINDOW'=338
|
||||||
'ZONE'=341
|
'WITH'=339
|
||||||
'<=>'=343
|
'WITHIN'=340
|
||||||
'<>'=344
|
'YEAR'=341
|
||||||
'!='=345
|
'YEARS'=342
|
||||||
'<'=346
|
'ZONE'=343
|
||||||
'>'=348
|
'<=>'=345
|
||||||
'+'=350
|
'<>'=346
|
||||||
'-'=351
|
'!='=347
|
||||||
'*'=352
|
'<'=348
|
||||||
'/'=353
|
'>'=350
|
||||||
'%'=354
|
'!'=352
|
||||||
'~'=355
|
'+'=353
|
||||||
'&'=356
|
'-'=354
|
||||||
'|'=357
|
'*'=355
|
||||||
'||'=358
|
'/'=356
|
||||||
'^'=359
|
'%'=357
|
||||||
':'=360
|
'~'=358
|
||||||
'->'=361
|
'&'=359
|
||||||
'=>'=362
|
'|'=360
|
||||||
'/*+'=363
|
'||'=361
|
||||||
'*/'=364
|
'^'=362
|
||||||
'?'=365
|
':'=363
|
||||||
|
'->'=364
|
||||||
|
'=>'=365
|
||||||
|
'/*+'=366
|
||||||
|
'*/'=367
|
||||||
|
'?'=368
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -242,144 +242,147 @@ KW_RESTRICT=241
|
|||||||
KW_REVOKE=242
|
KW_REVOKE=242
|
||||||
KW_RIGHT=243
|
KW_RIGHT=243
|
||||||
KW_RLIKE=244
|
KW_RLIKE=244
|
||||||
KW_ROLE=245
|
KW_REGEXP=245
|
||||||
KW_ROLES=246
|
KW_ROLE=246
|
||||||
KW_ROLLBACK=247
|
KW_ROLES=247
|
||||||
KW_ROLLUP=248
|
KW_ROLLBACK=248
|
||||||
KW_ROW=249
|
KW_ROLLUP=249
|
||||||
KW_ROWS=250
|
KW_ROW=250
|
||||||
KW_SECOND=251
|
KW_ROWS=251
|
||||||
KW_SECONDS=252
|
KW_SECOND=252
|
||||||
KW_SCHEMA=253
|
KW_SECONDS=253
|
||||||
KW_SCHEMAS=254
|
KW_SCHEMA=254
|
||||||
KW_SELECT=255
|
KW_SCHEMAS=255
|
||||||
KW_SEMI=256
|
KW_SELECT=256
|
||||||
KW_SEPARATED=257
|
KW_SEMI=257
|
||||||
KW_SERDE=258
|
KW_SEPARATED=258
|
||||||
KW_SERDEPROPERTIES=259
|
KW_SERDE=259
|
||||||
KW_SESSION_USER=260
|
KW_SERDEPROPERTIES=260
|
||||||
KW_SET=261
|
KW_SESSION_USER=261
|
||||||
KW_SETMINUS=262
|
KW_SET=262
|
||||||
KW_SETS=263
|
KW_SETMINUS=263
|
||||||
KW_SHORT=264
|
KW_SETS=264
|
||||||
KW_SHOW=265
|
KW_SHORT=265
|
||||||
KW_SINGLE=266
|
KW_SHOW=266
|
||||||
KW_SKEWED=267
|
KW_SINGLE=267
|
||||||
KW_SMALLINT=268
|
KW_SKEWED=268
|
||||||
KW_SOME=269
|
KW_SMALLINT=269
|
||||||
KW_SORT=270
|
KW_SOME=270
|
||||||
KW_SORTED=271
|
KW_SORT=271
|
||||||
KW_SOURCE=272
|
KW_SORTED=272
|
||||||
KW_START=273
|
KW_SOURCE=273
|
||||||
KW_STATISTICS=274
|
KW_START=274
|
||||||
KW_STORED=275
|
KW_STATISTICS=275
|
||||||
KW_STRATIFY=276
|
KW_STORED=276
|
||||||
KW_STRING=277
|
KW_STRATIFY=277
|
||||||
KW_STRUCT=278
|
KW_STRING=278
|
||||||
KW_SUBSTR=279
|
KW_STRUCT=279
|
||||||
KW_SUBSTRING=280
|
KW_SUBSTR=280
|
||||||
KW_SYNC=281
|
KW_SUBSTRING=281
|
||||||
KW_SYSTEM_TIME=282
|
KW_SYNC=282
|
||||||
KW_SYSTEM_VERSION=283
|
KW_SYSTEM=283
|
||||||
KW_TABLE=284
|
KW_SYSTEM_TIME=284
|
||||||
KW_TABLES=285
|
KW_SYSTEM_VERSION=285
|
||||||
KW_TABLESAMPLE=286
|
KW_TABLE=286
|
||||||
KW_TARGET=287
|
KW_TABLES=287
|
||||||
KW_TBLPROPERTIES=288
|
KW_TABLESAMPLE=288
|
||||||
KW_TEMPORARY=289
|
KW_TARGET=289
|
||||||
KW_TERMINATED=290
|
KW_TBLPROPERTIES=290
|
||||||
KW_THEN=291
|
KW_TEMPORARY=291
|
||||||
KW_TIME=292
|
KW_TERMINATED=292
|
||||||
KW_TIMEDIFF=293
|
KW_THEN=293
|
||||||
KW_TIMESTAMP=294
|
KW_TIME=294
|
||||||
KW_TIMESTAMP_LTZ=295
|
KW_TIMEDIFF=295
|
||||||
KW_TIMESTAMP_NTZ=296
|
KW_TIMESTAMP=296
|
||||||
KW_TIMESTAMPADD=297
|
KW_TIMESTAMP_LTZ=297
|
||||||
KW_TIMESTAMPDIFF=298
|
KW_TIMESTAMP_NTZ=298
|
||||||
KW_TINYINT=299
|
KW_TIMESTAMPADD=299
|
||||||
KW_TO=300
|
KW_TIMESTAMPDIFF=300
|
||||||
KW_TOUCH=301
|
KW_TINYINT=301
|
||||||
KW_TRAILING=302
|
KW_TO=302
|
||||||
KW_TRANSACTION=303
|
KW_TOUCH=303
|
||||||
KW_TRANSACTIONS=304
|
KW_TRAILING=304
|
||||||
KW_TRANSFORM=305
|
KW_TRANSACTION=305
|
||||||
KW_TRIM=306
|
KW_TRANSACTIONS=306
|
||||||
KW_TRUE=307
|
KW_TRANSFORM=307
|
||||||
KW_TRUNCATE=308
|
KW_TRIM=308
|
||||||
KW_TRY_CAST=309
|
KW_TRUE=309
|
||||||
KW_TYPE=310
|
KW_TRUNCATE=310
|
||||||
KW_UNARCHIVE=311
|
KW_TRY_CAST=311
|
||||||
KW_UNBOUNDED=312
|
KW_TYPE=312
|
||||||
KW_UNCACHE=313
|
KW_UNARCHIVE=313
|
||||||
KW_UNION=314
|
KW_UNBOUNDED=314
|
||||||
KW_UNIQUE=315
|
KW_UNCACHE=315
|
||||||
KW_UNKNOWN=316
|
KW_UNION=316
|
||||||
KW_UNLOCK=317
|
KW_UNIQUE=317
|
||||||
KW_UNPIVOT=318
|
KW_UNKNOWN=318
|
||||||
KW_UNSET=319
|
KW_UNLOCK=319
|
||||||
KW_UPDATE=320
|
KW_UNPIVOT=320
|
||||||
KW_USE=321
|
KW_UNSET=321
|
||||||
KW_USER=322
|
KW_UPDATE=322
|
||||||
KW_USING=323
|
KW_USE=323
|
||||||
KW_VALUES=324
|
KW_USER=324
|
||||||
KW_VARCHAR=325
|
KW_USING=325
|
||||||
KW_VAR=326
|
KW_VALUES=326
|
||||||
KW_VARIABLE=327
|
KW_VARCHAR=327
|
||||||
KW_VERSION=328
|
KW_VAR=328
|
||||||
KW_VIEW=329
|
KW_VARIABLE=329
|
||||||
KW_VIEWS=330
|
KW_VERSION=330
|
||||||
KW_VOID=331
|
KW_VIEW=331
|
||||||
KW_WEEK=332
|
KW_VIEWS=332
|
||||||
KW_WEEKS=333
|
KW_VOID=333
|
||||||
KW_WHEN=334
|
KW_WEEK=334
|
||||||
KW_WHERE=335
|
KW_WEEKS=335
|
||||||
KW_WINDOW=336
|
KW_WHEN=336
|
||||||
KW_WITH=337
|
KW_WHERE=337
|
||||||
KW_WITHIN=338
|
KW_WINDOW=338
|
||||||
KW_YEAR=339
|
KW_WITH=339
|
||||||
KW_YEARS=340
|
KW_WITHIN=340
|
||||||
KW_ZONE=341
|
KW_YEAR=341
|
||||||
EQ=342
|
KW_YEARS=342
|
||||||
NSEQ=343
|
KW_ZONE=343
|
||||||
NEQ=344
|
EQ=344
|
||||||
NEQJ=345
|
NSEQ=345
|
||||||
LT=346
|
NEQ=346
|
||||||
LTE=347
|
NEQJ=347
|
||||||
GT=348
|
LT=348
|
||||||
GTE=349
|
LTE=349
|
||||||
PLUS=350
|
GT=350
|
||||||
MINUS=351
|
GTE=351
|
||||||
ASTERISK=352
|
NOT=352
|
||||||
SLASH=353
|
PLUS=353
|
||||||
PERCENT=354
|
MINUS=354
|
||||||
TILDE=355
|
ASTERISK=355
|
||||||
AMPERSAND=356
|
SLASH=356
|
||||||
PIPE=357
|
PERCENT=357
|
||||||
CONCAT_PIPE=358
|
TILDE=358
|
||||||
HAT=359
|
AMPERSAND=359
|
||||||
COLON=360
|
PIPE=360
|
||||||
ARROW=361
|
CONCAT_PIPE=361
|
||||||
FAT_ARROW=362
|
HAT=362
|
||||||
HENT_START=363
|
COLON=363
|
||||||
HENT_END=364
|
ARROW=364
|
||||||
QUESTION=365
|
FAT_ARROW=365
|
||||||
STRING_LITERAL=366
|
HENT_START=366
|
||||||
DOUBLEQUOTED_STRING=367
|
HENT_END=367
|
||||||
BIGINT_LITERAL=368
|
QUESTION=368
|
||||||
SMALLINT_LITERAL=369
|
STRING_LITERAL=369
|
||||||
TINYINT_LITERAL=370
|
DOUBLEQUOTED_STRING=370
|
||||||
INTEGER_VALUE=371
|
BIGINT_LITERAL=371
|
||||||
EXPONENT_VALUE=372
|
SMALLINT_LITERAL=372
|
||||||
DECIMAL_VALUE=373
|
TINYINT_LITERAL=373
|
||||||
FLOAT_LITERAL=374
|
INTEGER_VALUE=374
|
||||||
DOUBLE_LITERAL=375
|
EXPONENT_VALUE=375
|
||||||
BIGDECIMAL_LITERAL=376
|
DECIMAL_VALUE=376
|
||||||
IDENTIFIER=377
|
FLOAT_LITERAL=377
|
||||||
BACKQUOTED_IDENTIFIER=378
|
DOUBLE_LITERAL=378
|
||||||
SIMPLE_COMMENT=379
|
BIGDECIMAL_LITERAL=379
|
||||||
BRACKETED_COMMENT=380
|
IDENTIFIER=380
|
||||||
WS=381
|
BACKQUOTED_IDENTIFIER=381
|
||||||
UNRECOGNIZED=382
|
SIMPLE_COMMENT=382
|
||||||
|
BRACKETED_COMMENT=383
|
||||||
|
WS=384
|
||||||
|
UNRECOGNIZED=385
|
||||||
';'=1
|
';'=1
|
||||||
'('=2
|
'('=2
|
||||||
')'=3
|
')'=3
|
||||||
@ -571,6 +574,7 @@ UNRECOGNIZED=382
|
|||||||
'NANOSECONDS'=189
|
'NANOSECONDS'=189
|
||||||
'NATURAL'=190
|
'NATURAL'=190
|
||||||
'NO'=191
|
'NO'=191
|
||||||
|
'NOT'=192
|
||||||
'NULL'=193
|
'NULL'=193
|
||||||
'NULLS'=194
|
'NULLS'=194
|
||||||
'NUMERIC'=195
|
'NUMERIC'=195
|
||||||
@ -622,120 +626,125 @@ UNRECOGNIZED=382
|
|||||||
'RESTRICT'=241
|
'RESTRICT'=241
|
||||||
'REVOKE'=242
|
'REVOKE'=242
|
||||||
'RIGHT'=243
|
'RIGHT'=243
|
||||||
'ROLE'=245
|
'RLIKE'=244
|
||||||
'ROLES'=246
|
'REGEXP'=245
|
||||||
'ROLLBACK'=247
|
'ROLE'=246
|
||||||
'ROLLUP'=248
|
'ROLES'=247
|
||||||
'ROW'=249
|
'ROLLBACK'=248
|
||||||
'ROWS'=250
|
'ROLLUP'=249
|
||||||
'SECOND'=251
|
'ROW'=250
|
||||||
'SECONDS'=252
|
'ROWS'=251
|
||||||
'SCHEMA'=253
|
'SECOND'=252
|
||||||
'SCHEMAS'=254
|
'SECONDS'=253
|
||||||
'SELECT'=255
|
'SCHEMA'=254
|
||||||
'SEMI'=256
|
'SCHEMAS'=255
|
||||||
'SEPARATED'=257
|
'SELECT'=256
|
||||||
'SERDE'=258
|
'SEMI'=257
|
||||||
'SERDEPROPERTIES'=259
|
'SEPARATED'=258
|
||||||
'SESSION_USER'=260
|
'SERDE'=259
|
||||||
'SET'=261
|
'SERDEPROPERTIES'=260
|
||||||
'MINUS'=262
|
'SESSION_USER'=261
|
||||||
'SETS'=263
|
'SET'=262
|
||||||
'SHORT'=264
|
'MINUS'=263
|
||||||
'SHOW'=265
|
'SETS'=264
|
||||||
'SINGLE'=266
|
'SHORT'=265
|
||||||
'SKEWED'=267
|
'SHOW'=266
|
||||||
'SMALLINT'=268
|
'SINGLE'=267
|
||||||
'SOME'=269
|
'SKEWED'=268
|
||||||
'SORT'=270
|
'SMALLINT'=269
|
||||||
'SORTED'=271
|
'SOME'=270
|
||||||
'SOURCE'=272
|
'SORT'=271
|
||||||
'START'=273
|
'SORTED'=272
|
||||||
'STATISTICS'=274
|
'SOURCE'=273
|
||||||
'STORED'=275
|
'START'=274
|
||||||
'STRATIFY'=276
|
'STATISTICS'=275
|
||||||
'STRING'=277
|
'STORED'=276
|
||||||
'STRUCT'=278
|
'STRATIFY'=277
|
||||||
'SUBSTR'=279
|
'STRING'=278
|
||||||
'SUBSTRING'=280
|
'STRUCT'=279
|
||||||
'SYNC'=281
|
'SUBSTR'=280
|
||||||
'SYSTEM_TIME'=282
|
'SUBSTRING'=281
|
||||||
'SYSTEM_VERSION'=283
|
'SYNC'=282
|
||||||
'TABLE'=284
|
'SYSTEM'=283
|
||||||
'TABLES'=285
|
'SYSTEM_TIME'=284
|
||||||
'TABLESAMPLE'=286
|
'SYSTEM_VERSION'=285
|
||||||
'TARGET'=287
|
'TABLE'=286
|
||||||
'TBLPROPERTIES'=288
|
'TABLES'=287
|
||||||
'TERMINATED'=290
|
'TABLESAMPLE'=288
|
||||||
'THEN'=291
|
'TARGET'=289
|
||||||
'TIME'=292
|
'TBLPROPERTIES'=290
|
||||||
'TIMEDIFF'=293
|
'TEMPORARY'=291
|
||||||
'TIMESTAMP'=294
|
'TERMINATED'=292
|
||||||
'TIMESTAMP_LTZ'=295
|
'THEN'=293
|
||||||
'TIMESTAMP_NTZ'=296
|
'TIME'=294
|
||||||
'TIMESTAMPADD'=297
|
'TIMEDIFF'=295
|
||||||
'TIMESTAMPDIFF'=298
|
'TIMESTAMP'=296
|
||||||
'TINYINT'=299
|
'TIMESTAMP_LTZ'=297
|
||||||
'TO'=300
|
'TIMESTAMP_NTZ'=298
|
||||||
'TOUCH'=301
|
'TIMESTAMPADD'=299
|
||||||
'TRAILING'=302
|
'TIMESTAMPDIFF'=300
|
||||||
'TRANSACTION'=303
|
'TINYINT'=301
|
||||||
'TRANSACTIONS'=304
|
'TO'=302
|
||||||
'TRANSFORM'=305
|
'TOUCH'=303
|
||||||
'TRIM'=306
|
'TRAILING'=304
|
||||||
'TRUE'=307
|
'TRANSACTION'=305
|
||||||
'TRUNCATE'=308
|
'TRANSACTIONS'=306
|
||||||
'TRY_CAST'=309
|
'TRANSFORM'=307
|
||||||
'TYPE'=310
|
'TRIM'=308
|
||||||
'UNARCHIVE'=311
|
'TRUE'=309
|
||||||
'UNBOUNDED'=312
|
'TRUNCATE'=310
|
||||||
'UNCACHE'=313
|
'TRY_CAST'=311
|
||||||
'UNION'=314
|
'TYPE'=312
|
||||||
'UNIQUE'=315
|
'UNARCHIVE'=313
|
||||||
'UNKNOWN'=316
|
'UNBOUNDED'=314
|
||||||
'UNLOCK'=317
|
'UNCACHE'=315
|
||||||
'UNPIVOT'=318
|
'UNION'=316
|
||||||
'UNSET'=319
|
'UNIQUE'=317
|
||||||
'UPDATE'=320
|
'UNKNOWN'=318
|
||||||
'USE'=321
|
'UNLOCK'=319
|
||||||
'USER'=322
|
'UNPIVOT'=320
|
||||||
'USING'=323
|
'UNSET'=321
|
||||||
'VALUES'=324
|
'UPDATE'=322
|
||||||
'VARCHAR'=325
|
'USE'=323
|
||||||
'VAR'=326
|
'USER'=324
|
||||||
'VARIABLE'=327
|
'USING'=325
|
||||||
'VERSION'=328
|
'VALUES'=326
|
||||||
'VIEW'=329
|
'VARCHAR'=327
|
||||||
'VIEWS'=330
|
'VAR'=328
|
||||||
'VOID'=331
|
'VARIABLE'=329
|
||||||
'WEEK'=332
|
'VERSION'=330
|
||||||
'WEEKS'=333
|
'VIEW'=331
|
||||||
'WHEN'=334
|
'VIEWS'=332
|
||||||
'WHERE'=335
|
'VOID'=333
|
||||||
'WINDOW'=336
|
'WEEK'=334
|
||||||
'WITH'=337
|
'WEEKS'=335
|
||||||
'WITHIN'=338
|
'WHEN'=336
|
||||||
'YEAR'=339
|
'WHERE'=337
|
||||||
'YEARS'=340
|
'WINDOW'=338
|
||||||
'ZONE'=341
|
'WITH'=339
|
||||||
'<=>'=343
|
'WITHIN'=340
|
||||||
'<>'=344
|
'YEAR'=341
|
||||||
'!='=345
|
'YEARS'=342
|
||||||
'<'=346
|
'ZONE'=343
|
||||||
'>'=348
|
'<=>'=345
|
||||||
'+'=350
|
'<>'=346
|
||||||
'-'=351
|
'!='=347
|
||||||
'*'=352
|
'<'=348
|
||||||
'/'=353
|
'>'=350
|
||||||
'%'=354
|
'!'=352
|
||||||
'~'=355
|
'+'=353
|
||||||
'&'=356
|
'-'=354
|
||||||
'|'=357
|
'*'=355
|
||||||
'||'=358
|
'/'=356
|
||||||
'^'=359
|
'%'=357
|
||||||
':'=360
|
'~'=358
|
||||||
'->'=361
|
'&'=359
|
||||||
'=>'=362
|
'|'=360
|
||||||
'/*+'=363
|
'||'=361
|
||||||
'*/'=364
|
'^'=362
|
||||||
'?'=365
|
':'=363
|
||||||
|
'->'=364
|
||||||
|
'=>'=365
|
||||||
|
'/*+'=366
|
||||||
|
'*/'=367
|
||||||
|
'?'=368
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,14 +1,10 @@
|
|||||||
// Generated from /Users/edy/github/dt-sql-parser/src/grammar/spark/SparkSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
// Generated from /Users/liuyi/Desktop/Projects/dtstack/dt-sql-parser/src/grammar/spark/SparkSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||||
|
|
||||||
|
|
||||||
import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener";
|
import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener";
|
||||||
|
|
||||||
import { ProgramContext } from "./SparkSqlParser";
|
import { ProgramContext } from "./SparkSqlParser";
|
||||||
import { SingleStatementContext } from "./SparkSqlParser";
|
import { SingleStatementContext } from "./SparkSqlParser";
|
||||||
import { TableIdentifierReferenceContext } from "./SparkSqlParser";
|
|
||||||
import { ViewIdentifierReferenceContext } from "./SparkSqlParser";
|
|
||||||
import { FunctionIdentifierReferenceContext } from "./SparkSqlParser";
|
|
||||||
import { NamespaceIdentifierReferenceContext } from "./SparkSqlParser";
|
|
||||||
import { StatementContext } from "./SparkSqlParser";
|
import { StatementContext } from "./SparkSqlParser";
|
||||||
import { TimezoneContext } from "./SparkSqlParser";
|
import { TimezoneContext } from "./SparkSqlParser";
|
||||||
import { ConfigKeyContext } from "./SparkSqlParser";
|
import { ConfigKeyContext } from "./SparkSqlParser";
|
||||||
@ -25,8 +21,8 @@ import { InsertIntoContext } from "./SparkSqlParser";
|
|||||||
import { PartitionSpecLocationContext } from "./SparkSqlParser";
|
import { PartitionSpecLocationContext } from "./SparkSqlParser";
|
||||||
import { PartitionSpecContext } from "./SparkSqlParser";
|
import { PartitionSpecContext } from "./SparkSqlParser";
|
||||||
import { PartitionValContext } from "./SparkSqlParser";
|
import { PartitionValContext } from "./SparkSqlParser";
|
||||||
import { NamespaceContext } from "./SparkSqlParser";
|
import { DbSchemaContext } from "./SparkSqlParser";
|
||||||
import { NamespacesContext } from "./SparkSqlParser";
|
import { DbSchemasContext } from "./SparkSqlParser";
|
||||||
import { DescribeFuncNameContext } from "./SparkSqlParser";
|
import { DescribeFuncNameContext } from "./SparkSqlParser";
|
||||||
import { DescribeColNameContext } from "./SparkSqlParser";
|
import { DescribeColNameContext } from "./SparkSqlParser";
|
||||||
import { CtesContext } from "./SparkSqlParser";
|
import { CtesContext } from "./SparkSqlParser";
|
||||||
@ -46,6 +42,12 @@ import { FileFormatContext } from "./SparkSqlParser";
|
|||||||
import { StorageHandlerContext } from "./SparkSqlParser";
|
import { StorageHandlerContext } from "./SparkSqlParser";
|
||||||
import { ResourceContext } from "./SparkSqlParser";
|
import { ResourceContext } from "./SparkSqlParser";
|
||||||
import { DmlStatementNoWithContext } from "./SparkSqlParser";
|
import { DmlStatementNoWithContext } from "./SparkSqlParser";
|
||||||
|
import { DbSchemaNameContext } from "./SparkSqlParser";
|
||||||
|
import { DbSchemaNameCreateContext } from "./SparkSqlParser";
|
||||||
|
import { TableNameCreateContext } from "./SparkSqlParser";
|
||||||
|
import { TableNameContext } from "./SparkSqlParser";
|
||||||
|
import { ViewNameCreateContext } from "./SparkSqlParser";
|
||||||
|
import { ViewNameContext } from "./SparkSqlParser";
|
||||||
import { IdentifierReferenceContext } from "./SparkSqlParser";
|
import { IdentifierReferenceContext } from "./SparkSqlParser";
|
||||||
import { QueryOrganizationContext } from "./SparkSqlParser";
|
import { QueryOrganizationContext } from "./SparkSqlParser";
|
||||||
import { MultiInsertQueryBodyContext } from "./SparkSqlParser";
|
import { MultiInsertQueryBodyContext } from "./SparkSqlParser";
|
||||||
@ -71,6 +73,7 @@ import { HavingClauseContext } from "./SparkSqlParser";
|
|||||||
import { HintContext } from "./SparkSqlParser";
|
import { HintContext } from "./SparkSqlParser";
|
||||||
import { HintStatementContext } from "./SparkSqlParser";
|
import { HintStatementContext } from "./SparkSqlParser";
|
||||||
import { FromClauseContext } from "./SparkSqlParser";
|
import { FromClauseContext } from "./SparkSqlParser";
|
||||||
|
import { FunctionKindContext } from "./SparkSqlParser";
|
||||||
import { TemporalClauseContext } from "./SparkSqlParser";
|
import { TemporalClauseContext } from "./SparkSqlParser";
|
||||||
import { AggregationClauseContext } from "./SparkSqlParser";
|
import { AggregationClauseContext } from "./SparkSqlParser";
|
||||||
import { GroupByClauseContext } from "./SparkSqlParser";
|
import { GroupByClauseContext } from "./SparkSqlParser";
|
||||||
@ -91,6 +94,8 @@ import { UnpivotNameColumnContext } from "./SparkSqlParser";
|
|||||||
import { UnpivotColumnAndAliasContext } from "./SparkSqlParser";
|
import { UnpivotColumnAndAliasContext } from "./SparkSqlParser";
|
||||||
import { UnpivotColumnContext } from "./SparkSqlParser";
|
import { UnpivotColumnContext } from "./SparkSqlParser";
|
||||||
import { UnpivotAliasContext } from "./SparkSqlParser";
|
import { UnpivotAliasContext } from "./SparkSqlParser";
|
||||||
|
import { IfNotExistsContext } from "./SparkSqlParser";
|
||||||
|
import { IfExistsContext } from "./SparkSqlParser";
|
||||||
import { LateralViewContext } from "./SparkSqlParser";
|
import { LateralViewContext } from "./SparkSqlParser";
|
||||||
import { SetQuantifierContext } from "./SparkSqlParser";
|
import { SetQuantifierContext } from "./SparkSqlParser";
|
||||||
import { RelationContext } from "./SparkSqlParser";
|
import { RelationContext } from "./SparkSqlParser";
|
||||||
@ -121,7 +126,7 @@ import { MultipartIdentifierContext } from "./SparkSqlParser";
|
|||||||
import { MultipartIdentifierPropertyListContext } from "./SparkSqlParser";
|
import { MultipartIdentifierPropertyListContext } from "./SparkSqlParser";
|
||||||
import { MultipartIdentifierPropertyContext } from "./SparkSqlParser";
|
import { MultipartIdentifierPropertyContext } from "./SparkSqlParser";
|
||||||
import { TableIdentifierContext } from "./SparkSqlParser";
|
import { TableIdentifierContext } from "./SparkSqlParser";
|
||||||
import { FunctionIdentifierContext } from "./SparkSqlParser";
|
import { ViewIdentifierContext } from "./SparkSqlParser";
|
||||||
import { NamedExpressionContext } from "./SparkSqlParser";
|
import { NamedExpressionContext } from "./SparkSqlParser";
|
||||||
import { NamedExpressionSeqContext } from "./SparkSqlParser";
|
import { NamedExpressionSeqContext } from "./SparkSqlParser";
|
||||||
import { PartitionFieldListContext } from "./SparkSqlParser";
|
import { PartitionFieldListContext } from "./SparkSqlParser";
|
||||||
@ -175,6 +180,7 @@ import { WindowFrameContext } from "./SparkSqlParser";
|
|||||||
import { FrameBoundContext } from "./SparkSqlParser";
|
import { FrameBoundContext } from "./SparkSqlParser";
|
||||||
import { QualifiedNameListContext } from "./SparkSqlParser";
|
import { QualifiedNameListContext } from "./SparkSqlParser";
|
||||||
import { FunctionNameContext } from "./SparkSqlParser";
|
import { FunctionNameContext } from "./SparkSqlParser";
|
||||||
|
import { FunctionNameCreateContext } from "./SparkSqlParser";
|
||||||
import { QualifiedNameContext } from "./SparkSqlParser";
|
import { QualifiedNameContext } from "./SparkSqlParser";
|
||||||
import { ErrorCapturingIdentifierContext } from "./SparkSqlParser";
|
import { ErrorCapturingIdentifierContext } from "./SparkSqlParser";
|
||||||
import { ErrorCapturingIdentifierExtraContext } from "./SparkSqlParser";
|
import { ErrorCapturingIdentifierExtraContext } from "./SparkSqlParser";
|
||||||
@ -219,50 +225,6 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitSingleStatement?: (ctx: SingleStatementContext) => void;
|
exitSingleStatement?: (ctx: SingleStatementContext) => void;
|
||||||
|
|
||||||
/**
|
|
||||||
* Enter a parse tree produced by `SparkSqlParser.tableIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
enterTableIdentifierReference?: (ctx: TableIdentifierReferenceContext) => void;
|
|
||||||
/**
|
|
||||||
* Exit a parse tree produced by `SparkSqlParser.tableIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
exitTableIdentifierReference?: (ctx: TableIdentifierReferenceContext) => void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enter a parse tree produced by `SparkSqlParser.viewIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
enterViewIdentifierReference?: (ctx: ViewIdentifierReferenceContext) => void;
|
|
||||||
/**
|
|
||||||
* Exit a parse tree produced by `SparkSqlParser.viewIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
exitViewIdentifierReference?: (ctx: ViewIdentifierReferenceContext) => void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enter a parse tree produced by `SparkSqlParser.functionIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
enterFunctionIdentifierReference?: (ctx: FunctionIdentifierReferenceContext) => void;
|
|
||||||
/**
|
|
||||||
* Exit a parse tree produced by `SparkSqlParser.functionIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
exitFunctionIdentifierReference?: (ctx: FunctionIdentifierReferenceContext) => void;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Enter a parse tree produced by `SparkSqlParser.namespaceIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
enterNamespaceIdentifierReference?: (ctx: NamespaceIdentifierReferenceContext) => void;
|
|
||||||
/**
|
|
||||||
* Exit a parse tree produced by `SparkSqlParser.namespaceIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
exitNamespaceIdentifierReference?: (ctx: NamespaceIdentifierReferenceContext) => void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.statement`.
|
* Enter a parse tree produced by `SparkSqlParser.statement`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -440,26 +402,26 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
|||||||
exitPartitionVal?: (ctx: PartitionValContext) => void;
|
exitPartitionVal?: (ctx: PartitionValContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.namespace`.
|
* Enter a parse tree produced by `SparkSqlParser.dbSchema`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
enterNamespace?: (ctx: NamespaceContext) => void;
|
enterDbSchema?: (ctx: DbSchemaContext) => void;
|
||||||
/**
|
/**
|
||||||
* Exit a parse tree produced by `SparkSqlParser.namespace`.
|
* Exit a parse tree produced by `SparkSqlParser.dbSchema`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
exitNamespace?: (ctx: NamespaceContext) => void;
|
exitDbSchema?: (ctx: DbSchemaContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.namespaces`.
|
* Enter a parse tree produced by `SparkSqlParser.dbSchemas`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
enterNamespaces?: (ctx: NamespacesContext) => void;
|
enterDbSchemas?: (ctx: DbSchemasContext) => void;
|
||||||
/**
|
/**
|
||||||
* Exit a parse tree produced by `SparkSqlParser.namespaces`.
|
* Exit a parse tree produced by `SparkSqlParser.dbSchemas`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
exitNamespaces?: (ctx: NamespacesContext) => void;
|
exitDbSchemas?: (ctx: DbSchemasContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.describeFuncName`.
|
* Enter a parse tree produced by `SparkSqlParser.describeFuncName`.
|
||||||
@ -670,6 +632,72 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitDmlStatementNoWith?: (ctx: DmlStatementNoWithContext) => void;
|
exitDmlStatementNoWith?: (ctx: DmlStatementNoWithContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.dbSchemaName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterDbSchemaName?: (ctx: DbSchemaNameContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.dbSchemaName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitDbSchemaName?: (ctx: DbSchemaNameContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.dbSchemaNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterDbSchemaNameCreate?: (ctx: DbSchemaNameCreateContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.dbSchemaNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitDbSchemaNameCreate?: (ctx: DbSchemaNameCreateContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.tableNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterTableNameCreate?: (ctx: TableNameCreateContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.tableNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitTableNameCreate?: (ctx: TableNameCreateContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.tableName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterTableName?: (ctx: TableNameContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.tableName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitTableName?: (ctx: TableNameContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.viewNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterViewNameCreate?: (ctx: ViewNameCreateContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.viewNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitViewNameCreate?: (ctx: ViewNameCreateContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.viewName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterViewName?: (ctx: ViewNameContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.viewName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitViewName?: (ctx: ViewNameContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.identifierReference`.
|
* Enter a parse tree produced by `SparkSqlParser.identifierReference`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -945,6 +973,17 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitFromClause?: (ctx: FromClauseContext) => void;
|
exitFromClause?: (ctx: FromClauseContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.functionKind`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterFunctionKind?: (ctx: FunctionKindContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.functionKind`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitFunctionKind?: (ctx: FunctionKindContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.temporalClause`.
|
* Enter a parse tree produced by `SparkSqlParser.temporalClause`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -1165,6 +1204,28 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitUnpivotAlias?: (ctx: UnpivotAliasContext) => void;
|
exitUnpivotAlias?: (ctx: UnpivotAliasContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.ifNotExists`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterIfNotExists?: (ctx: IfNotExistsContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.ifNotExists`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitIfNotExists?: (ctx: IfNotExistsContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.ifExists`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterIfExists?: (ctx: IfExistsContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.ifExists`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitIfExists?: (ctx: IfExistsContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.lateralView`.
|
* Enter a parse tree produced by `SparkSqlParser.lateralView`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -1496,15 +1557,15 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
|||||||
exitTableIdentifier?: (ctx: TableIdentifierContext) => void;
|
exitTableIdentifier?: (ctx: TableIdentifierContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.functionIdentifier`.
|
* Enter a parse tree produced by `SparkSqlParser.viewIdentifier`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
enterFunctionIdentifier?: (ctx: FunctionIdentifierContext) => void;
|
enterViewIdentifier?: (ctx: ViewIdentifierContext) => void;
|
||||||
/**
|
/**
|
||||||
* Exit a parse tree produced by `SparkSqlParser.functionIdentifier`.
|
* Exit a parse tree produced by `SparkSqlParser.viewIdentifier`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
exitFunctionIdentifier?: (ctx: FunctionIdentifierContext) => void;
|
exitViewIdentifier?: (ctx: ViewIdentifierContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.namedExpression`.
|
* Enter a parse tree produced by `SparkSqlParser.namedExpression`.
|
||||||
@ -2089,6 +2150,17 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitFunctionName?: (ctx: FunctionNameContext) => void;
|
exitFunctionName?: (ctx: FunctionNameContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.functionNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterFunctionNameCreate?: (ctx: FunctionNameCreateContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.functionNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitFunctionNameCreate?: (ctx: FunctionNameCreateContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.qualifiedName`.
|
* Enter a parse tree produced by `SparkSqlParser.qualifiedName`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
@ -1,14 +1,10 @@
|
|||||||
// Generated from /Users/edy/github/dt-sql-parser/src/grammar/spark/SparkSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
// Generated from /Users/liuyi/Desktop/Projects/dtstack/dt-sql-parser/src/grammar/spark/SparkSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||||
|
|
||||||
|
|
||||||
import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";
|
import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";
|
||||||
|
|
||||||
import { ProgramContext } from "./SparkSqlParser";
|
import { ProgramContext } from "./SparkSqlParser";
|
||||||
import { SingleStatementContext } from "./SparkSqlParser";
|
import { SingleStatementContext } from "./SparkSqlParser";
|
||||||
import { TableIdentifierReferenceContext } from "./SparkSqlParser";
|
|
||||||
import { ViewIdentifierReferenceContext } from "./SparkSqlParser";
|
|
||||||
import { FunctionIdentifierReferenceContext } from "./SparkSqlParser";
|
|
||||||
import { NamespaceIdentifierReferenceContext } from "./SparkSqlParser";
|
|
||||||
import { StatementContext } from "./SparkSqlParser";
|
import { StatementContext } from "./SparkSqlParser";
|
||||||
import { TimezoneContext } from "./SparkSqlParser";
|
import { TimezoneContext } from "./SparkSqlParser";
|
||||||
import { ConfigKeyContext } from "./SparkSqlParser";
|
import { ConfigKeyContext } from "./SparkSqlParser";
|
||||||
@ -25,8 +21,8 @@ import { InsertIntoContext } from "./SparkSqlParser";
|
|||||||
import { PartitionSpecLocationContext } from "./SparkSqlParser";
|
import { PartitionSpecLocationContext } from "./SparkSqlParser";
|
||||||
import { PartitionSpecContext } from "./SparkSqlParser";
|
import { PartitionSpecContext } from "./SparkSqlParser";
|
||||||
import { PartitionValContext } from "./SparkSqlParser";
|
import { PartitionValContext } from "./SparkSqlParser";
|
||||||
import { NamespaceContext } from "./SparkSqlParser";
|
import { DbSchemaContext } from "./SparkSqlParser";
|
||||||
import { NamespacesContext } from "./SparkSqlParser";
|
import { DbSchemasContext } from "./SparkSqlParser";
|
||||||
import { DescribeFuncNameContext } from "./SparkSqlParser";
|
import { DescribeFuncNameContext } from "./SparkSqlParser";
|
||||||
import { DescribeColNameContext } from "./SparkSqlParser";
|
import { DescribeColNameContext } from "./SparkSqlParser";
|
||||||
import { CtesContext } from "./SparkSqlParser";
|
import { CtesContext } from "./SparkSqlParser";
|
||||||
@ -46,6 +42,12 @@ import { FileFormatContext } from "./SparkSqlParser";
|
|||||||
import { StorageHandlerContext } from "./SparkSqlParser";
|
import { StorageHandlerContext } from "./SparkSqlParser";
|
||||||
import { ResourceContext } from "./SparkSqlParser";
|
import { ResourceContext } from "./SparkSqlParser";
|
||||||
import { DmlStatementNoWithContext } from "./SparkSqlParser";
|
import { DmlStatementNoWithContext } from "./SparkSqlParser";
|
||||||
|
import { DbSchemaNameContext } from "./SparkSqlParser";
|
||||||
|
import { DbSchemaNameCreateContext } from "./SparkSqlParser";
|
||||||
|
import { TableNameCreateContext } from "./SparkSqlParser";
|
||||||
|
import { TableNameContext } from "./SparkSqlParser";
|
||||||
|
import { ViewNameCreateContext } from "./SparkSqlParser";
|
||||||
|
import { ViewNameContext } from "./SparkSqlParser";
|
||||||
import { IdentifierReferenceContext } from "./SparkSqlParser";
|
import { IdentifierReferenceContext } from "./SparkSqlParser";
|
||||||
import { QueryOrganizationContext } from "./SparkSqlParser";
|
import { QueryOrganizationContext } from "./SparkSqlParser";
|
||||||
import { MultiInsertQueryBodyContext } from "./SparkSqlParser";
|
import { MultiInsertQueryBodyContext } from "./SparkSqlParser";
|
||||||
@ -71,6 +73,7 @@ import { HavingClauseContext } from "./SparkSqlParser";
|
|||||||
import { HintContext } from "./SparkSqlParser";
|
import { HintContext } from "./SparkSqlParser";
|
||||||
import { HintStatementContext } from "./SparkSqlParser";
|
import { HintStatementContext } from "./SparkSqlParser";
|
||||||
import { FromClauseContext } from "./SparkSqlParser";
|
import { FromClauseContext } from "./SparkSqlParser";
|
||||||
|
import { FunctionKindContext } from "./SparkSqlParser";
|
||||||
import { TemporalClauseContext } from "./SparkSqlParser";
|
import { TemporalClauseContext } from "./SparkSqlParser";
|
||||||
import { AggregationClauseContext } from "./SparkSqlParser";
|
import { AggregationClauseContext } from "./SparkSqlParser";
|
||||||
import { GroupByClauseContext } from "./SparkSqlParser";
|
import { GroupByClauseContext } from "./SparkSqlParser";
|
||||||
@ -91,6 +94,8 @@ import { UnpivotNameColumnContext } from "./SparkSqlParser";
|
|||||||
import { UnpivotColumnAndAliasContext } from "./SparkSqlParser";
|
import { UnpivotColumnAndAliasContext } from "./SparkSqlParser";
|
||||||
import { UnpivotColumnContext } from "./SparkSqlParser";
|
import { UnpivotColumnContext } from "./SparkSqlParser";
|
||||||
import { UnpivotAliasContext } from "./SparkSqlParser";
|
import { UnpivotAliasContext } from "./SparkSqlParser";
|
||||||
|
import { IfNotExistsContext } from "./SparkSqlParser";
|
||||||
|
import { IfExistsContext } from "./SparkSqlParser";
|
||||||
import { LateralViewContext } from "./SparkSqlParser";
|
import { LateralViewContext } from "./SparkSqlParser";
|
||||||
import { SetQuantifierContext } from "./SparkSqlParser";
|
import { SetQuantifierContext } from "./SparkSqlParser";
|
||||||
import { RelationContext } from "./SparkSqlParser";
|
import { RelationContext } from "./SparkSqlParser";
|
||||||
@ -121,7 +126,7 @@ import { MultipartIdentifierContext } from "./SparkSqlParser";
|
|||||||
import { MultipartIdentifierPropertyListContext } from "./SparkSqlParser";
|
import { MultipartIdentifierPropertyListContext } from "./SparkSqlParser";
|
||||||
import { MultipartIdentifierPropertyContext } from "./SparkSqlParser";
|
import { MultipartIdentifierPropertyContext } from "./SparkSqlParser";
|
||||||
import { TableIdentifierContext } from "./SparkSqlParser";
|
import { TableIdentifierContext } from "./SparkSqlParser";
|
||||||
import { FunctionIdentifierContext } from "./SparkSqlParser";
|
import { ViewIdentifierContext } from "./SparkSqlParser";
|
||||||
import { NamedExpressionContext } from "./SparkSqlParser";
|
import { NamedExpressionContext } from "./SparkSqlParser";
|
||||||
import { NamedExpressionSeqContext } from "./SparkSqlParser";
|
import { NamedExpressionSeqContext } from "./SparkSqlParser";
|
||||||
import { PartitionFieldListContext } from "./SparkSqlParser";
|
import { PartitionFieldListContext } from "./SparkSqlParser";
|
||||||
@ -175,6 +180,7 @@ import { WindowFrameContext } from "./SparkSqlParser";
|
|||||||
import { FrameBoundContext } from "./SparkSqlParser";
|
import { FrameBoundContext } from "./SparkSqlParser";
|
||||||
import { QualifiedNameListContext } from "./SparkSqlParser";
|
import { QualifiedNameListContext } from "./SparkSqlParser";
|
||||||
import { FunctionNameContext } from "./SparkSqlParser";
|
import { FunctionNameContext } from "./SparkSqlParser";
|
||||||
|
import { FunctionNameCreateContext } from "./SparkSqlParser";
|
||||||
import { QualifiedNameContext } from "./SparkSqlParser";
|
import { QualifiedNameContext } from "./SparkSqlParser";
|
||||||
import { ErrorCapturingIdentifierContext } from "./SparkSqlParser";
|
import { ErrorCapturingIdentifierContext } from "./SparkSqlParser";
|
||||||
import { ErrorCapturingIdentifierExtraContext } from "./SparkSqlParser";
|
import { ErrorCapturingIdentifierExtraContext } from "./SparkSqlParser";
|
||||||
@ -214,34 +220,6 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
|
|||||||
*/
|
*/
|
||||||
visitSingleStatement?: (ctx: SingleStatementContext) => Result;
|
visitSingleStatement?: (ctx: SingleStatementContext) => Result;
|
||||||
|
|
||||||
/**
|
|
||||||
* Visit a parse tree produced by `SparkSqlParser.tableIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
* @return the visitor result
|
|
||||||
*/
|
|
||||||
visitTableIdentifierReference?: (ctx: TableIdentifierReferenceContext) => Result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Visit a parse tree produced by `SparkSqlParser.viewIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
* @return the visitor result
|
|
||||||
*/
|
|
||||||
visitViewIdentifierReference?: (ctx: ViewIdentifierReferenceContext) => Result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Visit a parse tree produced by `SparkSqlParser.functionIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
* @return the visitor result
|
|
||||||
*/
|
|
||||||
visitFunctionIdentifierReference?: (ctx: FunctionIdentifierReferenceContext) => Result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Visit a parse tree produced by `SparkSqlParser.namespaceIdentifierReference`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
* @return the visitor result
|
|
||||||
*/
|
|
||||||
visitNamespaceIdentifierReference?: (ctx: NamespaceIdentifierReferenceContext) => Result;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.statement`.
|
* Visit a parse tree produced by `SparkSqlParser.statement`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -355,18 +333,18 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
|
|||||||
visitPartitionVal?: (ctx: PartitionValContext) => Result;
|
visitPartitionVal?: (ctx: PartitionValContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.namespace`.
|
* Visit a parse tree produced by `SparkSqlParser.dbSchema`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
* @return the visitor result
|
* @return the visitor result
|
||||||
*/
|
*/
|
||||||
visitNamespace?: (ctx: NamespaceContext) => Result;
|
visitDbSchema?: (ctx: DbSchemaContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.namespaces`.
|
* Visit a parse tree produced by `SparkSqlParser.dbSchemas`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
* @return the visitor result
|
* @return the visitor result
|
||||||
*/
|
*/
|
||||||
visitNamespaces?: (ctx: NamespacesContext) => Result;
|
visitDbSchemas?: (ctx: DbSchemasContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.describeFuncName`.
|
* Visit a parse tree produced by `SparkSqlParser.describeFuncName`.
|
||||||
@ -501,6 +479,48 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
|
|||||||
*/
|
*/
|
||||||
visitDmlStatementNoWith?: (ctx: DmlStatementNoWithContext) => Result;
|
visitDmlStatementNoWith?: (ctx: DmlStatementNoWithContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.dbSchemaName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitDbSchemaName?: (ctx: DbSchemaNameContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.dbSchemaNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitDbSchemaNameCreate?: (ctx: DbSchemaNameCreateContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.tableNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitTableNameCreate?: (ctx: TableNameCreateContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.tableName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitTableName?: (ctx: TableNameContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.viewNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitViewNameCreate?: (ctx: ViewNameCreateContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.viewName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitViewName?: (ctx: ViewNameContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.identifierReference`.
|
* Visit a parse tree produced by `SparkSqlParser.identifierReference`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -676,6 +696,13 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
|
|||||||
*/
|
*/
|
||||||
visitFromClause?: (ctx: FromClauseContext) => Result;
|
visitFromClause?: (ctx: FromClauseContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.functionKind`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitFunctionKind?: (ctx: FunctionKindContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.temporalClause`.
|
* Visit a parse tree produced by `SparkSqlParser.temporalClause`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -816,6 +843,20 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
|
|||||||
*/
|
*/
|
||||||
visitUnpivotAlias?: (ctx: UnpivotAliasContext) => Result;
|
visitUnpivotAlias?: (ctx: UnpivotAliasContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.ifNotExists`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitIfNotExists?: (ctx: IfNotExistsContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.ifExists`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitIfExists?: (ctx: IfExistsContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.lateralView`.
|
* Visit a parse tree produced by `SparkSqlParser.lateralView`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -1027,11 +1068,11 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
|
|||||||
visitTableIdentifier?: (ctx: TableIdentifierContext) => Result;
|
visitTableIdentifier?: (ctx: TableIdentifierContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.functionIdentifier`.
|
* Visit a parse tree produced by `SparkSqlParser.viewIdentifier`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
* @return the visitor result
|
* @return the visitor result
|
||||||
*/
|
*/
|
||||||
visitFunctionIdentifier?: (ctx: FunctionIdentifierContext) => Result;
|
visitViewIdentifier?: (ctx: ViewIdentifierContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.namedExpression`.
|
* Visit a parse tree produced by `SparkSqlParser.namedExpression`.
|
||||||
@ -1404,6 +1445,13 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
|
|||||||
*/
|
*/
|
||||||
visitFunctionName?: (ctx: FunctionNameContext) => Result;
|
visitFunctionName?: (ctx: FunctionNameContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.functionNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitFunctionNameCreate?: (ctx: FunctionNameCreateContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.qualifiedName`.
|
* Visit a parse tree produced by `SparkSqlParser.qualifiedName`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
@ -1,9 +1,10 @@
|
|||||||
import { Token } from 'antlr4ts';
|
import { Token } from 'antlr4ts';
|
||||||
import { CandidatesCollection } from 'antlr4-c3';
|
import { CandidatesCollection } from 'antlr4-c3';
|
||||||
import { SparkSqlLexer } from '../lib/spark/SparkSqlLexer';
|
import { SparkSqlLexer } from '../lib/spark/SparkSqlLexer';
|
||||||
import { SparkSqlParser, ProgramContext } from '../lib/spark/SparkSqlParser';
|
import { SparkSqlParser, ProgramContext, SingleStatementContext } from '../lib/spark/SparkSqlParser';
|
||||||
import BasicParser from './common/basicParser';
|
import BasicParser from './common/basicParser';
|
||||||
import { Suggestions } from './common/basic-parser-types';
|
import { Suggestions, SyntaxContextType, SyntaxSuggestion } from './common/basic-parser-types';
|
||||||
|
import { SparkSqlParserListener } from 'src/lib/spark/SparkSqlParserListener';
|
||||||
|
|
||||||
export default class SparkSQL extends BasicParser<SparkSqlLexer, ProgramContext, SparkSqlParser> {
|
export default class SparkSQL extends BasicParser<SparkSqlLexer, ProgramContext, SparkSqlParser> {
|
||||||
protected createLexerFormCharStream(charStreams) {
|
protected createLexerFormCharStream(charStreams) {
|
||||||
@ -12,23 +13,112 @@ export default class SparkSQL extends BasicParser<SparkSqlLexer, ProgramContext,
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected createParserFromTokenStream(tokenStream) {
|
protected createParserFromTokenStream(tokenStream) {
|
||||||
return new SparkSqlParser(tokenStream);
|
const parser = new SparkSqlParser(tokenStream);
|
||||||
|
return parser;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected preferredRules: Set<number> = new Set();
|
protected preferredRules: Set<number> = new Set([
|
||||||
|
SparkSqlParser.RULE_dbSchemaName,
|
||||||
|
SparkSqlParser.RULE_dbSchemaNameCreate,
|
||||||
|
SparkSqlParser.RULE_tableName,
|
||||||
|
SparkSqlParser.RULE_tableNameCreate,
|
||||||
|
SparkSqlParser.RULE_viewName,
|
||||||
|
SparkSqlParser.RULE_viewNameCreate,
|
||||||
|
SparkSqlParser.RULE_functionName,
|
||||||
|
SparkSqlParser.RULE_functionNameCreate,
|
||||||
|
]);
|
||||||
|
|
||||||
protected get splitListener() {
|
protected get splitListener() {
|
||||||
return null as any;
|
return new SparkSqlSplitListener();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected processCandidates(
|
protected processCandidates(
|
||||||
candidates: CandidatesCollection,
|
candidates: CandidatesCollection,
|
||||||
allTokens: Token[],
|
allTokens: Token[],
|
||||||
caretTokenIndex: number,
|
caretTokenIndex: number,
|
||||||
|
tokenIndexOffset: number,
|
||||||
): Suggestions<Token> {
|
): Suggestions<Token> {
|
||||||
|
const originalSyntaxSuggestions: SyntaxSuggestion<Token>[] = [];
|
||||||
|
const keywords: string[] = [];
|
||||||
|
|
||||||
|
for (const candidate of candidates.rules) {
|
||||||
|
const [ruleType, candidateRule] = candidate;
|
||||||
|
const startTokenIndex = candidateRule.startTokenIndex + tokenIndexOffset;
|
||||||
|
const tokenRanges = allTokens.slice(startTokenIndex, caretTokenIndex + tokenIndexOffset + 1);
|
||||||
|
|
||||||
|
let syntaxContextType: SyntaxContextType;
|
||||||
|
switch (ruleType) {
|
||||||
|
case SparkSqlParser.RULE_dbSchemaName: {
|
||||||
|
syntaxContextType = SyntaxContextType.DATABASE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SparkSqlParser.RULE_dbSchemaNameCreate: {
|
||||||
|
syntaxContextType = SyntaxContextType.DATABASE_CREATE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SparkSqlParser.RULE_tableName: {
|
||||||
|
syntaxContextType = SyntaxContextType.TABLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SparkSqlParser.RULE_tableNameCreate: {
|
||||||
|
syntaxContextType = SyntaxContextType.TABLE_CREATE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SparkSqlParser.RULE_viewName: {
|
||||||
|
syntaxContextType = SyntaxContextType.VIEW;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SparkSqlParser.RULE_viewNameCreate: {
|
||||||
|
syntaxContextType = SyntaxContextType.VIEW_CREATE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SparkSqlParser.RULE_functionName: {
|
||||||
|
syntaxContextType = SyntaxContextType.FUNCTION;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SparkSqlParser.RULE_functionNameCreate: {
|
||||||
|
syntaxContextType = SyntaxContextType.FUNCTION_CREATE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (syntaxContextType) {
|
||||||
|
originalSyntaxSuggestions.push({
|
||||||
|
syntaxContextType,
|
||||||
|
wordRanges: tokenRanges,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const candidate of candidates.tokens) {
|
||||||
|
const symbolicName = this._parser.vocabulary.getSymbolicName(candidate[0]);
|
||||||
|
const displayName = this._parser.vocabulary.getDisplayName(candidate[0]);
|
||||||
|
if (symbolicName && symbolicName.startsWith('KW_')) {
|
||||||
|
const keyword = displayName.startsWith("'") && displayName.endsWith("'") ? displayName.slice(1, -1) : displayName;
|
||||||
|
keywords.push(keyword);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
syntax: [],
|
syntax: originalSyntaxSuggestions,
|
||||||
keywords: [],
|
keywords,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class SparkSqlSplitListener implements SparkSqlParserListener {
|
||||||
|
private _statementsContext: SingleStatementContext[] = [];
|
||||||
|
|
||||||
|
exitSingleStatement = (ctx: SingleStatementContext) => {
|
||||||
|
this._statementsContext.push(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
|
enterSingleStatement = (ctx: SingleStatementContext) => {
|
||||||
|
};
|
||||||
|
|
||||||
|
get statementsContext() {
|
||||||
|
return this._statementsContext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -12,7 +12,7 @@ DROP VIEW db.v ;
|
|||||||
|
|
||||||
CREATE FUNCTION fn1;
|
CREATE FUNCTION fn1;
|
||||||
|
|
||||||
SELECT name, calculate_age(birthdate) AS age FROM students;
|
SELECT name, calculate_age(birthday) AS age FROM students;
|
||||||
|
|
||||||
CREATE DATABASE db;
|
CREATE DATABASE db;
|
||||||
|
|
||||||
|
19
test/parser/spark/suggestion/fixtures/syntaxSuggestion.sql
Normal file
19
test/parser/spark/suggestion/fixtures/syntaxSuggestion.sql
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
INSERT INTO db.tb ;
|
||||||
|
|
||||||
|
SELECT * FROM db.;
|
||||||
|
|
||||||
|
CREATE TABLE db. VALUES;
|
||||||
|
|
||||||
|
DROP TABLE IF EXISTS db.a;
|
||||||
|
|
||||||
|
CREATE OR REPLACE VIEW db.v;
|
||||||
|
|
||||||
|
DROP VIEW db.v ;
|
||||||
|
|
||||||
|
CREATE FUNCTION fn1;
|
||||||
|
|
||||||
|
SELECT name, calculate_age(birthday) AS age FROM students;
|
||||||
|
|
||||||
|
CREATE DATABASE db;
|
||||||
|
|
||||||
|
DROP SCHEMA IF EXISTS sch;
|
18
test/parser/spark/suggestion/fixtures/tokenSuggestion.sql
Normal file
18
test/parser/spark/suggestion/fixtures/tokenSuggestion.sql
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
ALTER
|
||||||
|
;
|
||||||
|
CREATE
|
||||||
|
;
|
||||||
|
DELETE
|
||||||
|
;
|
||||||
|
DESCRIBE
|
||||||
|
;
|
||||||
|
DROP
|
||||||
|
;
|
||||||
|
INSERT
|
||||||
|
;
|
||||||
|
LOAD
|
||||||
|
;
|
||||||
|
SHOW
|
||||||
|
;
|
||||||
|
EXPORT
|
||||||
|
;
|
146
test/parser/spark/suggestion/syntaxSuggestion.test.ts
Normal file
146
test/parser/spark/suggestion/syntaxSuggestion.test.ts
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||||
|
import SparkSQL from '../../../../src/parser/spark';
|
||||||
|
|
||||||
|
const syntaxSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'), 'utf-8');
|
||||||
|
|
||||||
|
describe('Spark SQL Syntax Suggestion', () => {
|
||||||
|
const parser = new SparkSQL();
|
||||||
|
|
||||||
|
test('Validate Syntax SQL', () => {
|
||||||
|
expect(parser.validate(syntaxSql).length).not.toBe(0);
|
||||||
|
expect(parser.validate(syntaxSql).length).not.toBe(0);
|
||||||
|
expect(parser.validate(syntaxSql).length).not.toBe(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Insert table ', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 1,
|
||||||
|
column: 18,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find((syn) => syn.syntaxContextType === SyntaxContextType.TABLE);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text))
|
||||||
|
.toEqual(['db', '.', 'tb']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select table ', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 3,
|
||||||
|
column: 18,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find((syn) => syn.syntaxContextType === SyntaxContextType.TABLE);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text))
|
||||||
|
.toEqual(['db', '.']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create table ', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 5,
|
||||||
|
column: 17,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find((syn) => syn.syntaxContextType === SyntaxContextType.TABLE_CREATE);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text))
|
||||||
|
.toEqual(['db', '.']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('DROP table ', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 7,
|
||||||
|
column: 26,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find((syn) => syn.syntaxContextType === SyntaxContextType.TABLE);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text))
|
||||||
|
.toEqual(['db', '.', 'a']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create view ', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 9,
|
||||||
|
column: 28,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find((syn) => syn.syntaxContextType === SyntaxContextType.VIEW_CREATE);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text))
|
||||||
|
.toEqual(['db', '.', 'v']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Drop view ', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 11,
|
||||||
|
column: 15,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find((syn) => syn.syntaxContextType === SyntaxContextType.VIEW);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text))
|
||||||
|
.toEqual(['db', '.', 'v']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create function ', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 13,
|
||||||
|
column: 20,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find((syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION_CREATE);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text))
|
||||||
|
.toEqual(['fn1']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Use function', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 15,
|
||||||
|
column: 27,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find((syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text))
|
||||||
|
.toEqual(['calculate_age']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create database', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 17,
|
||||||
|
column: 19,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find((syn) => syn.syntaxContextType === SyntaxContextType.DATABASE_CREATE);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text))
|
||||||
|
.toEqual(['db']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Drop database', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 19,
|
||||||
|
column: 26,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find((syn) => syn.syntaxContextType === SyntaxContextType.DATABASE);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text))
|
||||||
|
.toEqual(['sch']);
|
||||||
|
});
|
||||||
|
});
|
200
test/parser/spark/suggestion/tokenSuggestion.test.ts
Normal file
200
test/parser/spark/suggestion/tokenSuggestion.test.ts
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
import fs from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import { CaretPosition } from '../../../../src/parser/common/basic-parser-types';
|
||||||
|
import SparkSQL from '../../../../src/parser/spark';
|
||||||
|
|
||||||
|
const tokenSql = fs.readFileSync(path.join(__dirname, 'fixtures', 'tokenSuggestion.sql'), 'utf-8');
|
||||||
|
|
||||||
|
describe('Spark SQL Syntax Suggestion', () => {
|
||||||
|
const parser = new SparkSQL();
|
||||||
|
|
||||||
|
test('After ALTER', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 1,
|
||||||
|
column: 7,
|
||||||
|
};
|
||||||
|
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||||
|
tokenSql,
|
||||||
|
pos,
|
||||||
|
)?.keywords;
|
||||||
|
|
||||||
|
expect(suggestion).toEqual([
|
||||||
|
'TABLE',
|
||||||
|
'INDEX',
|
||||||
|
'VIEW',
|
||||||
|
'DATABASE',
|
||||||
|
'NAMESPACE',
|
||||||
|
'SCHEMA',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('After CREATE', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 3,
|
||||||
|
column: 8,
|
||||||
|
};
|
||||||
|
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||||
|
tokenSql,
|
||||||
|
pos,
|
||||||
|
)?.keywords;
|
||||||
|
|
||||||
|
expect(suggestion).toEqual([
|
||||||
|
'TEMPORARY',
|
||||||
|
'INDEX',
|
||||||
|
'ROLE',
|
||||||
|
'FUNCTION',
|
||||||
|
'OR',
|
||||||
|
'GLOBAL',
|
||||||
|
'VIEW',
|
||||||
|
'TABLE',
|
||||||
|
'EXTERNAL',
|
||||||
|
'DATABASE',
|
||||||
|
'NAMESPACE',
|
||||||
|
'SCHEMA',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('After DELETE', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 5,
|
||||||
|
column: 8,
|
||||||
|
};
|
||||||
|
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||||
|
tokenSql,
|
||||||
|
pos,
|
||||||
|
)?.keywords;
|
||||||
|
|
||||||
|
expect(suggestion).toEqual(['FROM']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('After DESCRIBE', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 7,
|
||||||
|
column: 10,
|
||||||
|
};
|
||||||
|
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||||
|
tokenSql,
|
||||||
|
pos,
|
||||||
|
)?.keywords;
|
||||||
|
|
||||||
|
expect(suggestion).toEqual([
|
||||||
|
'WITH',
|
||||||
|
'SELECT',
|
||||||
|
'MAP',
|
||||||
|
'REDUCE',
|
||||||
|
'FROM',
|
||||||
|
'TABLE',
|
||||||
|
'VALUES',
|
||||||
|
'QUERY',
|
||||||
|
'EXTENDED',
|
||||||
|
'FORMATTED',
|
||||||
|
'DATABASE',
|
||||||
|
'FUNCTION',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('After DROP', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 9,
|
||||||
|
column: 6,
|
||||||
|
};
|
||||||
|
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||||
|
tokenSql,
|
||||||
|
pos,
|
||||||
|
)?.keywords;
|
||||||
|
|
||||||
|
expect(suggestion).toEqual([
|
||||||
|
'TEMPORARY',
|
||||||
|
'INDEX',
|
||||||
|
'ROLE',
|
||||||
|
'FUNCTION',
|
||||||
|
'VIEW',
|
||||||
|
'TABLE',
|
||||||
|
'DATABASE',
|
||||||
|
'NAMESPACE',
|
||||||
|
'SCHEMA',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('After INSERT', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 11,
|
||||||
|
column: 8,
|
||||||
|
};
|
||||||
|
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||||
|
tokenSql,
|
||||||
|
pos,
|
||||||
|
)?.keywords;
|
||||||
|
|
||||||
|
expect(suggestion).toEqual([
|
||||||
|
'OVERWRITE',
|
||||||
|
'INTO',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('After LOAD', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 13,
|
||||||
|
column: 6,
|
||||||
|
};
|
||||||
|
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||||
|
tokenSql,
|
||||||
|
pos,
|
||||||
|
)?.keywords;
|
||||||
|
|
||||||
|
expect(suggestion).toEqual([
|
||||||
|
'DATA',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('After SHOW', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 15,
|
||||||
|
column: 6,
|
||||||
|
};
|
||||||
|
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||||
|
tokenSql,
|
||||||
|
pos,
|
||||||
|
)?.keywords;
|
||||||
|
|
||||||
|
expect(suggestion).toEqual([
|
||||||
|
'LOCKS',
|
||||||
|
'INDEXES',
|
||||||
|
'TRANSACTIONS',
|
||||||
|
'CREATE',
|
||||||
|
'COMPACTIONS',
|
||||||
|
'CURRENT',
|
||||||
|
'ROLES',
|
||||||
|
'PRINCIPALS',
|
||||||
|
'ROLE',
|
||||||
|
'GRANT',
|
||||||
|
'CATALOGS',
|
||||||
|
'FUNCTIONS',
|
||||||
|
'ALL',
|
||||||
|
'SYSTEM',
|
||||||
|
'USER',
|
||||||
|
'PARTITIONS',
|
||||||
|
'VIEWS',
|
||||||
|
'COLUMNS',
|
||||||
|
'TBLPROPERTIES',
|
||||||
|
'TABLE',
|
||||||
|
'TABLES',
|
||||||
|
'DATABASES',
|
||||||
|
'NAMESPACES',
|
||||||
|
'SCHEMAS',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('After EXPORT', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 17,
|
||||||
|
column: 8,
|
||||||
|
};
|
||||||
|
const suggestion = parser.getSuggestionAtCaretPosition(
|
||||||
|
tokenSql,
|
||||||
|
pos,
|
||||||
|
)?.keywords;
|
||||||
|
|
||||||
|
expect(suggestion).toEqual(['TABLE']);
|
||||||
|
});
|
||||||
|
});
|
6
test/parser/spark/syntax/fixtures/kwMultipleValues.sql
Normal file
6
test/parser/spark/syntax/fixtures/kwMultipleValues.sql
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
SELECT * FROM table_name WHERE NOT (age > 30);
|
||||||
|
SELECT * FROM table_name WHERE ! (age > 30);
|
||||||
|
|
||||||
|
|
||||||
|
SELECT * FROM table_name WHERE name RLIKE 'M+';
|
||||||
|
SELECT * FROM table_name WHERE name REGEXP 'M+';
|
23
test/parser/spark/syntax/kwMultipleValues.test.ts
Normal file
23
test/parser/spark/syntax/kwMultipleValues.test.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import SparkSQL from '../../../../src/parser/spark';
|
||||||
|
import { readSQL } from '../../../helper';
|
||||||
|
|
||||||
|
const parser = new SparkSQL();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关键词有多个值
|
||||||
|
* KW_NOT: 'NOT' | '!'
|
||||||
|
* KW_RLIKE: 'RLIKE' | 'REGEXP';
|
||||||
|
*/
|
||||||
|
const features = {
|
||||||
|
kwMultipleValues: readSQL(__dirname, 'kwMultipleValues.sql'),
|
||||||
|
};
|
||||||
|
|
||||||
|
describe('SparkSQL Insert Syntax Tests', () => {
|
||||||
|
Object.keys(features).forEach((key) => {
|
||||||
|
features[key].forEach((sql) => {
|
||||||
|
it(sql, () => {
|
||||||
|
expect(parser.validate(sql).length).toBe(0);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
Loading…
Reference in New Issue
Block a user