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_NATURAL: 'NATURAL';
|
||||
KW_NO: 'NO';
|
||||
KW_NOT: 'NOT' | '!';
|
||||
KW_NOT: 'NOT';
|
||||
KW_NULL: 'NULL';
|
||||
KW_NULLS: 'NULLS';
|
||||
KW_NUMERIC: 'NUMERIC';
|
||||
@ -290,7 +290,8 @@ KW_RESPECT: 'RESPECT';
|
||||
KW_RESTRICT: 'RESTRICT';
|
||||
KW_REVOKE: 'REVOKE';
|
||||
KW_RIGHT: 'RIGHT';
|
||||
KW_RLIKE: 'RLIKE' | 'REGEXP';
|
||||
KW_RLIKE: 'RLIKE';
|
||||
KW_REGEXP: 'REGEXP';
|
||||
KW_ROLE: 'ROLE';
|
||||
KW_ROLES: 'ROLES';
|
||||
KW_ROLLBACK: 'ROLLBACK';
|
||||
@ -328,6 +329,7 @@ KW_STRUCT: 'STRUCT';
|
||||
KW_SUBSTR: 'SUBSTR';
|
||||
KW_SUBSTRING: 'SUBSTRING';
|
||||
KW_SYNC: 'SYNC';
|
||||
KW_SYSTEM: 'SYSTEM';
|
||||
KW_SYSTEM_TIME: 'SYSTEM_TIME';
|
||||
KW_SYSTEM_VERSION: 'SYSTEM_VERSION';
|
||||
KW_TABLE: 'TABLE';
|
||||
@ -335,7 +337,7 @@ KW_TABLES: 'TABLES';
|
||||
KW_TABLESAMPLE: 'TABLESAMPLE';
|
||||
KW_TARGET: 'TARGET';
|
||||
KW_TBLPROPERTIES: 'TBLPROPERTIES';
|
||||
KW_TEMPORARY: 'TEMPORARY' | 'TEMP';
|
||||
KW_TEMPORARY: 'TEMPORARY';
|
||||
KW_TERMINATED: 'TERMINATED';
|
||||
KW_THEN: 'THEN';
|
||||
KW_TIME: 'TIME';
|
||||
@ -402,6 +404,7 @@ LTE : '<=' | '!>';
|
||||
GT : '>';
|
||||
GTE : '>=' | '!<';
|
||||
|
||||
NOT: '!';
|
||||
PLUS: '+';
|
||||
MINUS: '-';
|
||||
ASTERISK: '*';
|
||||
|
@ -54,34 +54,29 @@ singleStatement
|
||||
: statement SEMICOLON ?
|
||||
;
|
||||
|
||||
tableIdentifierReference: identifierReference;
|
||||
viewIdentifierReference: identifierReference;
|
||||
functionIdentifierReference: identifierReference;
|
||||
namespaceIdentifierReference: identifierReference;
|
||||
|
||||
statement
|
||||
: query
|
||||
| ctes? dmlStatementNoWith
|
||||
| KW_USE identifierReference
|
||||
| KW_USE namespace namespaceIdentifierReference
|
||||
| KW_USE dbSchemaName
|
||||
| KW_USE dbSchema dbSchemaName
|
||||
| KW_SET KW_CATALOG (identifier | stringLit)
|
||||
| KW_CREATE namespace (KW_IF KW_NOT KW_EXISTS)? namespaceIdentifierReference
|
||||
| KW_CREATE dbSchema (ifNotExists)? dbSchemaNameCreate
|
||||
(commentSpec |
|
||||
locationSpec |
|
||||
(KW_WITH (KW_DBPROPERTIES | KW_PROPERTIES) propertyList))*
|
||||
| KW_ALTER namespace namespaceIdentifierReference
|
||||
| KW_ALTER dbSchema dbSchemaName
|
||||
KW_SET (KW_DBPROPERTIES | KW_PROPERTIES) propertyList
|
||||
| KW_ALTER namespace namespaceIdentifierReference
|
||||
| KW_ALTER dbSchema dbSchemaName
|
||||
KW_SET locationSpec
|
||||
| KW_DROP namespace (KW_IF KW_EXISTS)? namespaceIdentifierReference
|
||||
| KW_DROP dbSchema (ifExists)? dbSchemaName
|
||||
(KW_RESTRICT | KW_CASCADE)?
|
||||
| KW_SHOW namespaces ((KW_FROM | KW_IN) multipartIdentifier)?
|
||||
| KW_SHOW dbSchemas ((KW_FROM | KW_IN) multipartIdentifier)?
|
||||
(KW_LIKE? pattern=stringLit)?
|
||||
| createTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider?
|
||||
createTableClauses
|
||||
(KW_AS? query)?
|
||||
| KW_CREATE KW_TABLE (KW_IF KW_NOT KW_EXISTS)? target=tableIdentifier
|
||||
KW_LIKE source=tableIdentifier
|
||||
| KW_CREATE KW_TABLE (ifNotExists)? target=tableNameCreate
|
||||
KW_LIKE source=tableName
|
||||
(tableProvider |
|
||||
rowFormat |
|
||||
createFileFormat |
|
||||
@ -90,112 +85,111 @@ statement
|
||||
| replaceTableHeader (LEFT_PAREN createOrReplaceTableColTypeList RIGHT_PAREN)? tableProvider?
|
||||
createTableClauses
|
||||
(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)?
|
||||
| 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)?
|
||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
||||
| KW_ALTER KW_TABLE tableName
|
||||
KW_ADD (KW_COLUMN | KW_COLUMNS)
|
||||
qualifiedColTypeWithPositionList
|
||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
||||
| KW_ALTER KW_TABLE tableName
|
||||
KW_ADD (KW_COLUMN | KW_COLUMNS)
|
||||
LEFT_PAREN qualifiedColTypeWithPositionList RIGHT_PAREN
|
||||
| KW_ALTER KW_TABLE table=tableIdentifierReference
|
||||
| KW_ALTER KW_TABLE table=tableName
|
||||
KW_RENAME KW_COLUMN
|
||||
multipartIdentifier KW_TO errorCapturingIdentifier
|
||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
||||
KW_DROP (KW_COLUMN | KW_COLUMNS) (KW_IF KW_EXISTS)?
|
||||
| KW_ALTER KW_TABLE tableName
|
||||
KW_DROP (KW_COLUMN | KW_COLUMNS) (ifExists)?
|
||||
LEFT_PAREN multipartIdentifierList RIGHT_PAREN
|
||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
||||
KW_DROP (KW_COLUMN | KW_COLUMNS) (KW_IF KW_EXISTS)?
|
||||
| KW_ALTER KW_TABLE tableName
|
||||
KW_DROP (KW_COLUMN | KW_COLUMNS) (ifExists)?
|
||||
multipartIdentifierList
|
||||
| KW_ALTER (KW_TABLE | KW_VIEW) (tableIdentifierReference | viewIdentifierReference)
|
||||
| KW_ALTER (KW_TABLE | KW_VIEW) (tableName | viewName)
|
||||
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_ALTER (KW_TABLE | KW_VIEW) (tableIdentifierReference | viewIdentifierReference)
|
||||
KW_UNSET KW_TBLPROPERTIES (KW_IF KW_EXISTS)? propertyList
|
||||
| KW_ALTER KW_TABLE table=tableIdentifierReference
|
||||
| KW_ALTER (KW_TABLE | KW_VIEW) (tableName | viewName)
|
||||
KW_UNSET KW_TBLPROPERTIES (ifExists)? propertyList
|
||||
| KW_ALTER KW_TABLE table=tableName
|
||||
(KW_ALTER | KW_CHANGE) KW_COLUMN? column=multipartIdentifier
|
||||
alterColumnAction?
|
||||
| KW_ALTER KW_TABLE table=tableIdentifierReference partitionSpec?
|
||||
| KW_ALTER KW_TABLE table=tableName partitionSpec?
|
||||
KW_CHANGE KW_COLUMN?
|
||||
colName=multipartIdentifier colType colPosition?
|
||||
| KW_ALTER KW_TABLE table=tableIdentifierReference partitionSpec?
|
||||
| KW_ALTER KW_TABLE table=tableName partitionSpec?
|
||||
KW_REPLACE KW_COLUMNS
|
||||
LEFT_PAREN qualifiedColTypeWithPositionList
|
||||
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_ALTER KW_TABLE tableIdentifierReference (partitionSpec)?
|
||||
| KW_ALTER KW_TABLE tableName (partitionSpec)?
|
||||
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+
|
||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
||||
| KW_ALTER KW_TABLE tableName
|
||||
partitionSpec KW_RENAME KW_TO partitionSpec
|
||||
| KW_ALTER (KW_TABLE | KW_VIEW) (tableIdentifierReference | viewIdentifierReference)
|
||||
KW_DROP (KW_IF KW_EXISTS)? partitionSpec (COMMA partitionSpec)* KW_PURGE?
|
||||
| KW_ALTER KW_TABLE tableIdentifierReference
|
||||
| KW_ALTER (KW_TABLE | KW_VIEW) (tableName | viewName)
|
||||
KW_DROP (ifExists)? partitionSpec (COMMA partitionSpec)* KW_PURGE?
|
||||
| KW_ALTER KW_TABLE tableName
|
||||
(partitionSpec)? KW_SET locationSpec
|
||||
| KW_ALTER KW_TABLE tableIdentifierReference KW_RECOVER KW_PARTITIONS
|
||||
| KW_DROP KW_TABLE (KW_IF KW_EXISTS)? tableIdentifierReference KW_PURGE?
|
||||
| KW_DROP KW_VIEW (KW_IF KW_EXISTS)? viewIdentifierReference
|
||||
| KW_ALTER KW_TABLE tableName KW_RECOVER KW_PARTITIONS
|
||||
| KW_DROP KW_TABLE (ifExists)? tableName KW_PURGE?
|
||||
| KW_DROP KW_VIEW (ifExists)? viewName
|
||||
| KW_CREATE (KW_OR KW_REPLACE)? (KW_GLOBAL? KW_TEMPORARY)?
|
||||
KW_VIEW (KW_IF KW_NOT KW_EXISTS)? viewIdentifierReference
|
||||
KW_VIEW (ifNotExists)? viewNameCreate
|
||||
identifierCommentList?
|
||||
(commentSpec |
|
||||
(KW_PARTITIONED KW_ON identifierList) |
|
||||
(KW_TBLPROPERTIES propertyList))*
|
||||
KW_AS query
|
||||
| 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_ALTER KW_VIEW viewIdentifierReference KW_AS? query
|
||||
| KW_CREATE (KW_OR KW_REPLACE)? KW_TEMPORARY? KW_FUNCTION (KW_IF KW_NOT KW_EXISTS)?
|
||||
functionIdentifierReference KW_AS className=stringLit
|
||||
| KW_ALTER KW_VIEW viewName KW_AS? query
|
||||
| KW_CREATE (KW_OR KW_REPLACE)? KW_TEMPORARY? KW_FUNCTION (ifNotExists)?
|
||||
functionNameCreate KW_AS className=stringLit
|
||||
(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?
|
||||
functionIdentifierReference dataType? variableDefaultExpression?
|
||||
| KW_DROP KW_TEMPORARY KW_VARIABLE (KW_IF KW_EXISTS)? identifierReference
|
||||
functionName dataType? variableDefaultExpression?
|
||||
| KW_DROP KW_TEMPORARY KW_VARIABLE (ifExists)? (tableName | viewName | functionName)
|
||||
| KW_EXPLAIN (KW_LOGICAL | KW_FORMATTED | KW_EXTENDED | KW_CODEGEN | KW_COST)?
|
||||
statement
|
||||
| KW_SHOW KW_TABLES ((KW_FROM | KW_IN) tableIdentifierReference)?
|
||||
| KW_SHOW KW_TABLES ((KW_FROM | KW_IN) dbSchemaName)?
|
||||
(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_SHOW KW_TBLPROPERTIES table=tableIdentifierReference
|
||||
| KW_SHOW KW_TBLPROPERTIES table=tableName
|
||||
(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_SHOW KW_VIEWS ((KW_FROM | KW_IN) viewIdentifierReference)?
|
||||
| KW_SHOW KW_VIEWS ((KW_FROM | KW_IN) dbSchemaName)?
|
||||
(KW_LIKE? pattern=stringLit)?
|
||||
| KW_SHOW KW_PARTITIONS identifierReference partitionSpec?
|
||||
| KW_SHOW identifier? KW_FUNCTIONS ((KW_FROM | KW_IN) ns=tableIdentifierReference)?
|
||||
| KW_SHOW KW_PARTITIONS tableName partitionSpec?
|
||||
| KW_SHOW functionKind? KW_FUNCTIONS ((KW_FROM | KW_IN) ns=dbSchemaName)?
|
||||
(KW_LIKE? (legacy=multipartIdentifier | pattern=stringLit))?
|
||||
| KW_SHOW KW_CREATE KW_TABLE tableIdentifierReference (KW_AS KW_SERDE)?
|
||||
| KW_SHOW KW_CURRENT namespace
|
||||
| KW_SHOW KW_CREATE KW_TABLE tableName (KW_AS KW_SERDE)?
|
||||
| KW_SHOW KW_CURRENT dbSchema
|
||||
| KW_SHOW KW_CATALOGS (KW_LIKE? pattern=stringLit)?
|
||||
| (KW_DESC | KW_DESCRIBE) KW_FUNCTION KW_EXTENDED? describeFuncName
|
||||
| (KW_DESC | KW_DESCRIBE) namespace KW_EXTENDED?
|
||||
namespaceIdentifierReference
|
||||
| (KW_DESC | KW_DESCRIBE) KW_DATABASE KW_EXTENDED? dbSchemaName
|
||||
| (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_COMMENT KW_ON namespace namespaceIdentifierReference KW_IS
|
||||
| KW_COMMENT KW_ON dbSchema dbSchemaName KW_IS
|
||||
comment
|
||||
| KW_COMMENT KW_ON KW_TABLE tableIdentifierReference KW_IS comment
|
||||
| KW_REFRESH KW_TABLE tableIdentifierReference
|
||||
| KW_REFRESH KW_FUNCTION functionIdentifierReference
|
||||
| KW_COMMENT KW_ON KW_TABLE tableName KW_IS comment
|
||||
| KW_REFRESH KW_TABLE tableName
|
||||
| KW_REFRESH KW_FUNCTION functionName
|
||||
| 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_UNCACHE KW_TABLE (KW_IF KW_EXISTS)? tableIdentifierReference
|
||||
| KW_UNCACHE KW_TABLE (ifExists)? tableName
|
||||
| KW_CLEAR KW_CACHE
|
||||
| KW_LOAD KW_DATA KW_LOCAL? KW_INPATH path=stringLit KW_OVERWRITE? KW_INTO KW_TABLE
|
||||
tableIdentifierReference partitionSpec?
|
||||
| KW_TRUNCATE KW_TABLE tableIdentifierReference partitionSpec?
|
||||
| (KW_MSCK)? KW_REPAIR KW_TABLE tableIdentifierReference
|
||||
tableName partitionSpec?
|
||||
| KW_TRUNCATE KW_TABLE tableName partitionSpec?
|
||||
| (KW_MSCK)? KW_REPAIR KW_TABLE tableName
|
||||
(option=(KW_ADD|KW_DROP|KW_SYNC) KW_PARTITIONS)?
|
||||
| op=(KW_ADD | KW_LIST) identifier .*?
|
||||
| KW_SET KW_ROLE .*?
|
||||
@ -211,11 +205,11 @@ statement
|
||||
| KW_SET .*?
|
||||
| KW_RESET configKey
|
||||
| KW_RESET .*?
|
||||
| KW_CREATE KW_INDEX (KW_IF KW_NOT KW_EXISTS)? identifier KW_ON KW_TABLE?
|
||||
tableIdentifierReference (KW_USING indexType=identifier)?
|
||||
| KW_CREATE KW_INDEX (ifNotExists)? identifier KW_ON KW_TABLE?
|
||||
tableName (KW_USING indexType=identifier)?
|
||||
LEFT_PAREN multipartIdentifierPropertyList RIGHT_PAREN
|
||||
(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 .*?
|
||||
;
|
||||
|
||||
@ -258,21 +252,21 @@ unsupportedHiveNativeCommands
|
||||
| kw1=KW_UNLOCK kw2=KW_DATABASE
|
||||
| kw1=KW_CREATE 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 tableIdentifier 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 tableIdentifier 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 tableIdentifier 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 tableIdentifier 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 tableIdentifier kw3=KW_UNARCHIVE kw4=KW_PARTITION
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier kw3=KW_TOUCH
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier partitionSpec? kw3=KW_COMPACT
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier partitionSpec? kw3=KW_CONCATENATE
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableIdentifier 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 kw3=KW_NOT kw4=KW_CLUSTERED
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_CLUSTERED kw4=KW_BY
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_NOT kw4=KW_SORTED
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_SKEWED kw4=KW_BY
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_NOT kw4=KW_SKEWED
|
||||
| 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 tableName kw3=KW_SET kw4=KW_SKEWED kw5=KW_LOCATION
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_EXCHANGE kw4=KW_PARTITION
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_ARCHIVE kw4=KW_PARTITION
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_UNARCHIVE kw4=KW_PARTITION
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName kw3=KW_TOUCH
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName partitionSpec? kw3=KW_COMPACT
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName partitionSpec? kw3=KW_CONCATENATE
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName partitionSpec? kw3=KW_SET kw4=KW_FILEFORMAT
|
||||
| kw1=KW_ALTER kw2=KW_TABLE tableName partitionSpec? kw3=KW_REPLACE kw4=KW_COLUMNS
|
||||
| kw1=KW_START kw2=KW_TRANSACTION
|
||||
| kw1=KW_COMMIT
|
||||
| kw1=KW_ROLLBACK
|
||||
@ -280,11 +274,11 @@ unsupportedHiveNativeCommands
|
||||
;
|
||||
|
||||
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
|
||||
: (KW_CREATE KW_OR)? KW_REPLACE KW_TABLE tableIdentifierReference
|
||||
: (KW_CREATE KW_OR)? KW_REPLACE KW_TABLE tableNameCreate
|
||||
;
|
||||
|
||||
bucketSpec
|
||||
@ -312,9 +306,9 @@ query
|
||||
;
|
||||
|
||||
insertInto
|
||||
: KW_INSERT KW_OVERWRITE KW_TABLE? tableIdentifierReference (partitionSpec (KW_IF KW_NOT KW_EXISTS)?)? ((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? tableIdentifierReference KW_REPLACE whereClause
|
||||
: KW_INSERT KW_OVERWRITE KW_TABLE? tableName (partitionSpec (ifNotExists)?)? ((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? 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)? tableProvider (KW_OPTIONS options=propertyList)?
|
||||
;
|
||||
@ -332,13 +326,13 @@ partitionVal
|
||||
| identifier EQ KW_DEFAULT
|
||||
;
|
||||
|
||||
namespace
|
||||
dbSchema
|
||||
: KW_NAMESPACE
|
||||
| KW_DATABASE
|
||||
| KW_SCHEMA
|
||||
;
|
||||
|
||||
namespaces
|
||||
dbSchemas
|
||||
: KW_NAMESPACES
|
||||
| KW_DATABASES
|
||||
| KW_SCHEMAS
|
||||
@ -437,9 +431,9 @@ resource
|
||||
dmlStatementNoWith
|
||||
: insertInto query
|
||||
| fromClause multiInsertQueryBody+
|
||||
| KW_DELETE KW_FROM identifierReference tableAlias whereClause?
|
||||
| KW_UPDATE identifierReference tableAlias setClause whereClause?
|
||||
| KW_MERGE KW_INTO target=identifierReference targetAlias=tableAlias
|
||||
| KW_DELETE KW_FROM tableName tableAlias whereClause?
|
||||
| KW_UPDATE tableName tableAlias setClause whereClause?
|
||||
| KW_MERGE KW_INTO target=tableName targetAlias=tableAlias
|
||||
KW_USING (source=identifierReference |
|
||||
LEFT_PAREN sourceQuery=query RIGHT_PAREN) sourceAlias=tableAlias
|
||||
KW_ON mergeCondition=booleanExpression
|
||||
@ -448,6 +442,13 @@ dmlStatementNoWith
|
||||
notMatchedBySourceClause*
|
||||
;
|
||||
|
||||
dbSchemaName: identifierReference;
|
||||
dbSchemaNameCreate: identifierReference;
|
||||
tableNameCreate : tableIdentifier;
|
||||
tableName : tableIdentifier;
|
||||
viewNameCreate : viewIdentifier;
|
||||
viewName : viewIdentifier;
|
||||
|
||||
identifierReference
|
||||
: KW_IDENTIFIER_KW LEFT_PAREN expression RIGHT_PAREN
|
||||
| multipartIdentifier
|
||||
@ -480,7 +481,7 @@ queryTerm
|
||||
queryPrimary
|
||||
: querySpecification
|
||||
| fromStatement
|
||||
| KW_TABLE tableIdentifierReference
|
||||
| KW_TABLE tableName
|
||||
| inlineTable
|
||||
| LEFT_PAREN query RIGHT_PAREN
|
||||
;
|
||||
@ -600,6 +601,10 @@ fromClause
|
||||
: KW_FROM relation (COMMA relation)* lateralView* pivotClause? unpivotClause?
|
||||
;
|
||||
|
||||
functionKind
|
||||
: KW_USER | KW_SYSTEM | KW_ALL
|
||||
;
|
||||
|
||||
temporalClause
|
||||
: 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
|
||||
@ -695,8 +700,14 @@ unpivotAlias
|
||||
: KW_AS? identifier
|
||||
;
|
||||
|
||||
ifNotExists
|
||||
: KW_IF KW_NOT KW_EXISTS;
|
||||
|
||||
ifExists
|
||||
: KW_IF KW_EXISTS;
|
||||
|
||||
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
|
||||
@ -706,6 +717,7 @@ setQuantifier
|
||||
|
||||
relation
|
||||
: KW_LATERAL? relationPrimary relationExtension*
|
||||
| tableName
|
||||
;
|
||||
|
||||
relationExtension
|
||||
@ -784,8 +796,8 @@ inlineTable
|
||||
;
|
||||
|
||||
functionTableSubqueryArgument
|
||||
: KW_TABLE tableIdentifierReference tableArgumentPartitioning?
|
||||
| KW_TABLE LEFT_PAREN tableIdentifierReference RIGHT_PAREN tableArgumentPartitioning?
|
||||
: KW_TABLE tableName tableArgumentPartitioning?
|
||||
| KW_TABLE LEFT_PAREN tableName RIGHT_PAREN tableArgumentPartitioning?
|
||||
| KW_TABLE LEFT_PAREN query RIGHT_PAREN tableArgumentPartitioning?
|
||||
;
|
||||
|
||||
@ -814,7 +826,7 @@ functionTableArgument
|
||||
;
|
||||
|
||||
functionTable
|
||||
: funcName=functionName LEFT_PAREN
|
||||
: functionName LEFT_PAREN
|
||||
(functionTableArgument (COMMA functionTableArgument)*)?
|
||||
RIGHT_PAREN tableAlias
|
||||
;
|
||||
@ -853,8 +865,8 @@ tableIdentifier
|
||||
: (db=errorCapturingIdentifier DOT)? table=errorCapturingIdentifier
|
||||
;
|
||||
|
||||
functionIdentifier
|
||||
: (db=errorCapturingIdentifier DOT)? function=errorCapturingIdentifier
|
||||
viewIdentifier
|
||||
: (db=errorCapturingIdentifier DOT)? view=errorCapturingIdentifier
|
||||
;
|
||||
|
||||
namedExpression
|
||||
@ -903,7 +915,7 @@ expressionSeq
|
||||
;
|
||||
|
||||
booleanExpression
|
||||
: KW_NOT booleanExpression
|
||||
: (KW_NOT | NOT) booleanExpression
|
||||
| KW_EXISTS LEFT_PAREN query RIGHT_PAREN
|
||||
| valueExpression predicate?
|
||||
| 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_IN LEFT_PAREN expression (COMMA expression)* 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) pattern=valueExpression (KW_ESCAPE escapeChar=stringLit)?
|
||||
| KW_IS KW_NOT? kind=KW_NULL
|
||||
@ -1195,6 +1207,10 @@ functionName
|
||||
| KW_RIGHT
|
||||
;
|
||||
|
||||
functionNameCreate
|
||||
: qualifiedName
|
||||
;
|
||||
|
||||
qualifiedName
|
||||
: identifier (DOT identifier)*
|
||||
;
|
||||
@ -1462,6 +1478,7 @@ ansiNonReserved
|
||||
| KW_RESTRICT
|
||||
| KW_REVOKE
|
||||
| KW_RLIKE
|
||||
| KW_REGEXP
|
||||
| KW_ROLE
|
||||
| KW_ROLES
|
||||
| KW_ROLLBACK
|
||||
@ -1496,6 +1513,7 @@ ansiNonReserved
|
||||
| KW_SUBSTR
|
||||
| KW_SUBSTRING
|
||||
| KW_SYNC
|
||||
| KW_SYSTEM
|
||||
| KW_SYSTEM_TIME
|
||||
| KW_SYSTEM_VERSION
|
||||
| KW_TABLES
|
||||
@ -1801,6 +1819,7 @@ nonReserved
|
||||
| KW_RESTRICT
|
||||
| KW_REVOKE
|
||||
| KW_RLIKE
|
||||
| KW_REGEXP
|
||||
| KW_ROLE
|
||||
| KW_ROLES
|
||||
| KW_ROLLBACK
|
||||
@ -1836,6 +1855,7 @@ nonReserved
|
||||
| KW_SUBSTR
|
||||
| KW_SUBSTRING
|
||||
| KW_SYNC
|
||||
| KW_SYSTEM
|
||||
| KW_SYSTEM_TIME
|
||||
| KW_SYSTEM_VERSION
|
||||
| KW_TABLE
|
||||
|
File diff suppressed because one or more lines are too long
@ -242,144 +242,147 @@ KW_RESTRICT=241
|
||||
KW_REVOKE=242
|
||||
KW_RIGHT=243
|
||||
KW_RLIKE=244
|
||||
KW_ROLE=245
|
||||
KW_ROLES=246
|
||||
KW_ROLLBACK=247
|
||||
KW_ROLLUP=248
|
||||
KW_ROW=249
|
||||
KW_ROWS=250
|
||||
KW_SECOND=251
|
||||
KW_SECONDS=252
|
||||
KW_SCHEMA=253
|
||||
KW_SCHEMAS=254
|
||||
KW_SELECT=255
|
||||
KW_SEMI=256
|
||||
KW_SEPARATED=257
|
||||
KW_SERDE=258
|
||||
KW_SERDEPROPERTIES=259
|
||||
KW_SESSION_USER=260
|
||||
KW_SET=261
|
||||
KW_SETMINUS=262
|
||||
KW_SETS=263
|
||||
KW_SHORT=264
|
||||
KW_SHOW=265
|
||||
KW_SINGLE=266
|
||||
KW_SKEWED=267
|
||||
KW_SMALLINT=268
|
||||
KW_SOME=269
|
||||
KW_SORT=270
|
||||
KW_SORTED=271
|
||||
KW_SOURCE=272
|
||||
KW_START=273
|
||||
KW_STATISTICS=274
|
||||
KW_STORED=275
|
||||
KW_STRATIFY=276
|
||||
KW_STRING=277
|
||||
KW_STRUCT=278
|
||||
KW_SUBSTR=279
|
||||
KW_SUBSTRING=280
|
||||
KW_SYNC=281
|
||||
KW_SYSTEM_TIME=282
|
||||
KW_SYSTEM_VERSION=283
|
||||
KW_TABLE=284
|
||||
KW_TABLES=285
|
||||
KW_TABLESAMPLE=286
|
||||
KW_TARGET=287
|
||||
KW_TBLPROPERTIES=288
|
||||
KW_TEMPORARY=289
|
||||
KW_TERMINATED=290
|
||||
KW_THEN=291
|
||||
KW_TIME=292
|
||||
KW_TIMEDIFF=293
|
||||
KW_TIMESTAMP=294
|
||||
KW_TIMESTAMP_LTZ=295
|
||||
KW_TIMESTAMP_NTZ=296
|
||||
KW_TIMESTAMPADD=297
|
||||
KW_TIMESTAMPDIFF=298
|
||||
KW_TINYINT=299
|
||||
KW_TO=300
|
||||
KW_TOUCH=301
|
||||
KW_TRAILING=302
|
||||
KW_TRANSACTION=303
|
||||
KW_TRANSACTIONS=304
|
||||
KW_TRANSFORM=305
|
||||
KW_TRIM=306
|
||||
KW_TRUE=307
|
||||
KW_TRUNCATE=308
|
||||
KW_TRY_CAST=309
|
||||
KW_TYPE=310
|
||||
KW_UNARCHIVE=311
|
||||
KW_UNBOUNDED=312
|
||||
KW_UNCACHE=313
|
||||
KW_UNION=314
|
||||
KW_UNIQUE=315
|
||||
KW_UNKNOWN=316
|
||||
KW_UNLOCK=317
|
||||
KW_UNPIVOT=318
|
||||
KW_UNSET=319
|
||||
KW_UPDATE=320
|
||||
KW_USE=321
|
||||
KW_USER=322
|
||||
KW_USING=323
|
||||
KW_VALUES=324
|
||||
KW_VARCHAR=325
|
||||
KW_VAR=326
|
||||
KW_VARIABLE=327
|
||||
KW_VERSION=328
|
||||
KW_VIEW=329
|
||||
KW_VIEWS=330
|
||||
KW_VOID=331
|
||||
KW_WEEK=332
|
||||
KW_WEEKS=333
|
||||
KW_WHEN=334
|
||||
KW_WHERE=335
|
||||
KW_WINDOW=336
|
||||
KW_WITH=337
|
||||
KW_WITHIN=338
|
||||
KW_YEAR=339
|
||||
KW_YEARS=340
|
||||
KW_ZONE=341
|
||||
EQ=342
|
||||
NSEQ=343
|
||||
NEQ=344
|
||||
NEQJ=345
|
||||
LT=346
|
||||
LTE=347
|
||||
GT=348
|
||||
GTE=349
|
||||
PLUS=350
|
||||
MINUS=351
|
||||
ASTERISK=352
|
||||
SLASH=353
|
||||
PERCENT=354
|
||||
TILDE=355
|
||||
AMPERSAND=356
|
||||
PIPE=357
|
||||
CONCAT_PIPE=358
|
||||
HAT=359
|
||||
COLON=360
|
||||
ARROW=361
|
||||
FAT_ARROW=362
|
||||
HENT_START=363
|
||||
HENT_END=364
|
||||
QUESTION=365
|
||||
STRING_LITERAL=366
|
||||
DOUBLEQUOTED_STRING=367
|
||||
BIGINT_LITERAL=368
|
||||
SMALLINT_LITERAL=369
|
||||
TINYINT_LITERAL=370
|
||||
INTEGER_VALUE=371
|
||||
EXPONENT_VALUE=372
|
||||
DECIMAL_VALUE=373
|
||||
FLOAT_LITERAL=374
|
||||
DOUBLE_LITERAL=375
|
||||
BIGDECIMAL_LITERAL=376
|
||||
IDENTIFIER=377
|
||||
BACKQUOTED_IDENTIFIER=378
|
||||
SIMPLE_COMMENT=379
|
||||
BRACKETED_COMMENT=380
|
||||
WS=381
|
||||
UNRECOGNIZED=382
|
||||
KW_REGEXP=245
|
||||
KW_ROLE=246
|
||||
KW_ROLES=247
|
||||
KW_ROLLBACK=248
|
||||
KW_ROLLUP=249
|
||||
KW_ROW=250
|
||||
KW_ROWS=251
|
||||
KW_SECOND=252
|
||||
KW_SECONDS=253
|
||||
KW_SCHEMA=254
|
||||
KW_SCHEMAS=255
|
||||
KW_SELECT=256
|
||||
KW_SEMI=257
|
||||
KW_SEPARATED=258
|
||||
KW_SERDE=259
|
||||
KW_SERDEPROPERTIES=260
|
||||
KW_SESSION_USER=261
|
||||
KW_SET=262
|
||||
KW_SETMINUS=263
|
||||
KW_SETS=264
|
||||
KW_SHORT=265
|
||||
KW_SHOW=266
|
||||
KW_SINGLE=267
|
||||
KW_SKEWED=268
|
||||
KW_SMALLINT=269
|
||||
KW_SOME=270
|
||||
KW_SORT=271
|
||||
KW_SORTED=272
|
||||
KW_SOURCE=273
|
||||
KW_START=274
|
||||
KW_STATISTICS=275
|
||||
KW_STORED=276
|
||||
KW_STRATIFY=277
|
||||
KW_STRING=278
|
||||
KW_STRUCT=279
|
||||
KW_SUBSTR=280
|
||||
KW_SUBSTRING=281
|
||||
KW_SYNC=282
|
||||
KW_SYSTEM=283
|
||||
KW_SYSTEM_TIME=284
|
||||
KW_SYSTEM_VERSION=285
|
||||
KW_TABLE=286
|
||||
KW_TABLES=287
|
||||
KW_TABLESAMPLE=288
|
||||
KW_TARGET=289
|
||||
KW_TBLPROPERTIES=290
|
||||
KW_TEMPORARY=291
|
||||
KW_TERMINATED=292
|
||||
KW_THEN=293
|
||||
KW_TIME=294
|
||||
KW_TIMEDIFF=295
|
||||
KW_TIMESTAMP=296
|
||||
KW_TIMESTAMP_LTZ=297
|
||||
KW_TIMESTAMP_NTZ=298
|
||||
KW_TIMESTAMPADD=299
|
||||
KW_TIMESTAMPDIFF=300
|
||||
KW_TINYINT=301
|
||||
KW_TO=302
|
||||
KW_TOUCH=303
|
||||
KW_TRAILING=304
|
||||
KW_TRANSACTION=305
|
||||
KW_TRANSACTIONS=306
|
||||
KW_TRANSFORM=307
|
||||
KW_TRIM=308
|
||||
KW_TRUE=309
|
||||
KW_TRUNCATE=310
|
||||
KW_TRY_CAST=311
|
||||
KW_TYPE=312
|
||||
KW_UNARCHIVE=313
|
||||
KW_UNBOUNDED=314
|
||||
KW_UNCACHE=315
|
||||
KW_UNION=316
|
||||
KW_UNIQUE=317
|
||||
KW_UNKNOWN=318
|
||||
KW_UNLOCK=319
|
||||
KW_UNPIVOT=320
|
||||
KW_UNSET=321
|
||||
KW_UPDATE=322
|
||||
KW_USE=323
|
||||
KW_USER=324
|
||||
KW_USING=325
|
||||
KW_VALUES=326
|
||||
KW_VARCHAR=327
|
||||
KW_VAR=328
|
||||
KW_VARIABLE=329
|
||||
KW_VERSION=330
|
||||
KW_VIEW=331
|
||||
KW_VIEWS=332
|
||||
KW_VOID=333
|
||||
KW_WEEK=334
|
||||
KW_WEEKS=335
|
||||
KW_WHEN=336
|
||||
KW_WHERE=337
|
||||
KW_WINDOW=338
|
||||
KW_WITH=339
|
||||
KW_WITHIN=340
|
||||
KW_YEAR=341
|
||||
KW_YEARS=342
|
||||
KW_ZONE=343
|
||||
EQ=344
|
||||
NSEQ=345
|
||||
NEQ=346
|
||||
NEQJ=347
|
||||
LT=348
|
||||
LTE=349
|
||||
GT=350
|
||||
GTE=351
|
||||
NOT=352
|
||||
PLUS=353
|
||||
MINUS=354
|
||||
ASTERISK=355
|
||||
SLASH=356
|
||||
PERCENT=357
|
||||
TILDE=358
|
||||
AMPERSAND=359
|
||||
PIPE=360
|
||||
CONCAT_PIPE=361
|
||||
HAT=362
|
||||
COLON=363
|
||||
ARROW=364
|
||||
FAT_ARROW=365
|
||||
HENT_START=366
|
||||
HENT_END=367
|
||||
QUESTION=368
|
||||
STRING_LITERAL=369
|
||||
DOUBLEQUOTED_STRING=370
|
||||
BIGINT_LITERAL=371
|
||||
SMALLINT_LITERAL=372
|
||||
TINYINT_LITERAL=373
|
||||
INTEGER_VALUE=374
|
||||
EXPONENT_VALUE=375
|
||||
DECIMAL_VALUE=376
|
||||
FLOAT_LITERAL=377
|
||||
DOUBLE_LITERAL=378
|
||||
BIGDECIMAL_LITERAL=379
|
||||
IDENTIFIER=380
|
||||
BACKQUOTED_IDENTIFIER=381
|
||||
SIMPLE_COMMENT=382
|
||||
BRACKETED_COMMENT=383
|
||||
WS=384
|
||||
UNRECOGNIZED=385
|
||||
';'=1
|
||||
'('=2
|
||||
')'=3
|
||||
@ -571,6 +574,7 @@ UNRECOGNIZED=382
|
||||
'NANOSECONDS'=189
|
||||
'NATURAL'=190
|
||||
'NO'=191
|
||||
'NOT'=192
|
||||
'NULL'=193
|
||||
'NULLS'=194
|
||||
'NUMERIC'=195
|
||||
@ -622,120 +626,125 @@ UNRECOGNIZED=382
|
||||
'RESTRICT'=241
|
||||
'REVOKE'=242
|
||||
'RIGHT'=243
|
||||
'ROLE'=245
|
||||
'ROLES'=246
|
||||
'ROLLBACK'=247
|
||||
'ROLLUP'=248
|
||||
'ROW'=249
|
||||
'ROWS'=250
|
||||
'SECOND'=251
|
||||
'SECONDS'=252
|
||||
'SCHEMA'=253
|
||||
'SCHEMAS'=254
|
||||
'SELECT'=255
|
||||
'SEMI'=256
|
||||
'SEPARATED'=257
|
||||
'SERDE'=258
|
||||
'SERDEPROPERTIES'=259
|
||||
'SESSION_USER'=260
|
||||
'SET'=261
|
||||
'MINUS'=262
|
||||
'SETS'=263
|
||||
'SHORT'=264
|
||||
'SHOW'=265
|
||||
'SINGLE'=266
|
||||
'SKEWED'=267
|
||||
'SMALLINT'=268
|
||||
'SOME'=269
|
||||
'SORT'=270
|
||||
'SORTED'=271
|
||||
'SOURCE'=272
|
||||
'START'=273
|
||||
'STATISTICS'=274
|
||||
'STORED'=275
|
||||
'STRATIFY'=276
|
||||
'STRING'=277
|
||||
'STRUCT'=278
|
||||
'SUBSTR'=279
|
||||
'SUBSTRING'=280
|
||||
'SYNC'=281
|
||||
'SYSTEM_TIME'=282
|
||||
'SYSTEM_VERSION'=283
|
||||
'TABLE'=284
|
||||
'TABLES'=285
|
||||
'TABLESAMPLE'=286
|
||||
'TARGET'=287
|
||||
'TBLPROPERTIES'=288
|
||||
'TERMINATED'=290
|
||||
'THEN'=291
|
||||
'TIME'=292
|
||||
'TIMEDIFF'=293
|
||||
'TIMESTAMP'=294
|
||||
'TIMESTAMP_LTZ'=295
|
||||
'TIMESTAMP_NTZ'=296
|
||||
'TIMESTAMPADD'=297
|
||||
'TIMESTAMPDIFF'=298
|
||||
'TINYINT'=299
|
||||
'TO'=300
|
||||
'TOUCH'=301
|
||||
'TRAILING'=302
|
||||
'TRANSACTION'=303
|
||||
'TRANSACTIONS'=304
|
||||
'TRANSFORM'=305
|
||||
'TRIM'=306
|
||||
'TRUE'=307
|
||||
'TRUNCATE'=308
|
||||
'TRY_CAST'=309
|
||||
'TYPE'=310
|
||||
'UNARCHIVE'=311
|
||||
'UNBOUNDED'=312
|
||||
'UNCACHE'=313
|
||||
'UNION'=314
|
||||
'UNIQUE'=315
|
||||
'UNKNOWN'=316
|
||||
'UNLOCK'=317
|
||||
'UNPIVOT'=318
|
||||
'UNSET'=319
|
||||
'UPDATE'=320
|
||||
'USE'=321
|
||||
'USER'=322
|
||||
'USING'=323
|
||||
'VALUES'=324
|
||||
'VARCHAR'=325
|
||||
'VAR'=326
|
||||
'VARIABLE'=327
|
||||
'VERSION'=328
|
||||
'VIEW'=329
|
||||
'VIEWS'=330
|
||||
'VOID'=331
|
||||
'WEEK'=332
|
||||
'WEEKS'=333
|
||||
'WHEN'=334
|
||||
'WHERE'=335
|
||||
'WINDOW'=336
|
||||
'WITH'=337
|
||||
'WITHIN'=338
|
||||
'YEAR'=339
|
||||
'YEARS'=340
|
||||
'ZONE'=341
|
||||
'<=>'=343
|
||||
'<>'=344
|
||||
'!='=345
|
||||
'<'=346
|
||||
'>'=348
|
||||
'+'=350
|
||||
'-'=351
|
||||
'*'=352
|
||||
'/'=353
|
||||
'%'=354
|
||||
'~'=355
|
||||
'&'=356
|
||||
'|'=357
|
||||
'||'=358
|
||||
'^'=359
|
||||
':'=360
|
||||
'->'=361
|
||||
'=>'=362
|
||||
'/*+'=363
|
||||
'*/'=364
|
||||
'?'=365
|
||||
'RLIKE'=244
|
||||
'REGEXP'=245
|
||||
'ROLE'=246
|
||||
'ROLES'=247
|
||||
'ROLLBACK'=248
|
||||
'ROLLUP'=249
|
||||
'ROW'=250
|
||||
'ROWS'=251
|
||||
'SECOND'=252
|
||||
'SECONDS'=253
|
||||
'SCHEMA'=254
|
||||
'SCHEMAS'=255
|
||||
'SELECT'=256
|
||||
'SEMI'=257
|
||||
'SEPARATED'=258
|
||||
'SERDE'=259
|
||||
'SERDEPROPERTIES'=260
|
||||
'SESSION_USER'=261
|
||||
'SET'=262
|
||||
'MINUS'=263
|
||||
'SETS'=264
|
||||
'SHORT'=265
|
||||
'SHOW'=266
|
||||
'SINGLE'=267
|
||||
'SKEWED'=268
|
||||
'SMALLINT'=269
|
||||
'SOME'=270
|
||||
'SORT'=271
|
||||
'SORTED'=272
|
||||
'SOURCE'=273
|
||||
'START'=274
|
||||
'STATISTICS'=275
|
||||
'STORED'=276
|
||||
'STRATIFY'=277
|
||||
'STRING'=278
|
||||
'STRUCT'=279
|
||||
'SUBSTR'=280
|
||||
'SUBSTRING'=281
|
||||
'SYNC'=282
|
||||
'SYSTEM'=283
|
||||
'SYSTEM_TIME'=284
|
||||
'SYSTEM_VERSION'=285
|
||||
'TABLE'=286
|
||||
'TABLES'=287
|
||||
'TABLESAMPLE'=288
|
||||
'TARGET'=289
|
||||
'TBLPROPERTIES'=290
|
||||
'TEMPORARY'=291
|
||||
'TERMINATED'=292
|
||||
'THEN'=293
|
||||
'TIME'=294
|
||||
'TIMEDIFF'=295
|
||||
'TIMESTAMP'=296
|
||||
'TIMESTAMP_LTZ'=297
|
||||
'TIMESTAMP_NTZ'=298
|
||||
'TIMESTAMPADD'=299
|
||||
'TIMESTAMPDIFF'=300
|
||||
'TINYINT'=301
|
||||
'TO'=302
|
||||
'TOUCH'=303
|
||||
'TRAILING'=304
|
||||
'TRANSACTION'=305
|
||||
'TRANSACTIONS'=306
|
||||
'TRANSFORM'=307
|
||||
'TRIM'=308
|
||||
'TRUE'=309
|
||||
'TRUNCATE'=310
|
||||
'TRY_CAST'=311
|
||||
'TYPE'=312
|
||||
'UNARCHIVE'=313
|
||||
'UNBOUNDED'=314
|
||||
'UNCACHE'=315
|
||||
'UNION'=316
|
||||
'UNIQUE'=317
|
||||
'UNKNOWN'=318
|
||||
'UNLOCK'=319
|
||||
'UNPIVOT'=320
|
||||
'UNSET'=321
|
||||
'UPDATE'=322
|
||||
'USE'=323
|
||||
'USER'=324
|
||||
'USING'=325
|
||||
'VALUES'=326
|
||||
'VARCHAR'=327
|
||||
'VAR'=328
|
||||
'VARIABLE'=329
|
||||
'VERSION'=330
|
||||
'VIEW'=331
|
||||
'VIEWS'=332
|
||||
'VOID'=333
|
||||
'WEEK'=334
|
||||
'WEEKS'=335
|
||||
'WHEN'=336
|
||||
'WHERE'=337
|
||||
'WINDOW'=338
|
||||
'WITH'=339
|
||||
'WITHIN'=340
|
||||
'YEAR'=341
|
||||
'YEARS'=342
|
||||
'ZONE'=343
|
||||
'<=>'=345
|
||||
'<>'=346
|
||||
'!='=347
|
||||
'<'=348
|
||||
'>'=350
|
||||
'!'=352
|
||||
'+'=353
|
||||
'-'=354
|
||||
'*'=355
|
||||
'/'=356
|
||||
'%'=357
|
||||
'~'=358
|
||||
'&'=359
|
||||
'|'=360
|
||||
'||'=361
|
||||
'^'=362
|
||||
':'=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_RIGHT=243
|
||||
KW_RLIKE=244
|
||||
KW_ROLE=245
|
||||
KW_ROLES=246
|
||||
KW_ROLLBACK=247
|
||||
KW_ROLLUP=248
|
||||
KW_ROW=249
|
||||
KW_ROWS=250
|
||||
KW_SECOND=251
|
||||
KW_SECONDS=252
|
||||
KW_SCHEMA=253
|
||||
KW_SCHEMAS=254
|
||||
KW_SELECT=255
|
||||
KW_SEMI=256
|
||||
KW_SEPARATED=257
|
||||
KW_SERDE=258
|
||||
KW_SERDEPROPERTIES=259
|
||||
KW_SESSION_USER=260
|
||||
KW_SET=261
|
||||
KW_SETMINUS=262
|
||||
KW_SETS=263
|
||||
KW_SHORT=264
|
||||
KW_SHOW=265
|
||||
KW_SINGLE=266
|
||||
KW_SKEWED=267
|
||||
KW_SMALLINT=268
|
||||
KW_SOME=269
|
||||
KW_SORT=270
|
||||
KW_SORTED=271
|
||||
KW_SOURCE=272
|
||||
KW_START=273
|
||||
KW_STATISTICS=274
|
||||
KW_STORED=275
|
||||
KW_STRATIFY=276
|
||||
KW_STRING=277
|
||||
KW_STRUCT=278
|
||||
KW_SUBSTR=279
|
||||
KW_SUBSTRING=280
|
||||
KW_SYNC=281
|
||||
KW_SYSTEM_TIME=282
|
||||
KW_SYSTEM_VERSION=283
|
||||
KW_TABLE=284
|
||||
KW_TABLES=285
|
||||
KW_TABLESAMPLE=286
|
||||
KW_TARGET=287
|
||||
KW_TBLPROPERTIES=288
|
||||
KW_TEMPORARY=289
|
||||
KW_TERMINATED=290
|
||||
KW_THEN=291
|
||||
KW_TIME=292
|
||||
KW_TIMEDIFF=293
|
||||
KW_TIMESTAMP=294
|
||||
KW_TIMESTAMP_LTZ=295
|
||||
KW_TIMESTAMP_NTZ=296
|
||||
KW_TIMESTAMPADD=297
|
||||
KW_TIMESTAMPDIFF=298
|
||||
KW_TINYINT=299
|
||||
KW_TO=300
|
||||
KW_TOUCH=301
|
||||
KW_TRAILING=302
|
||||
KW_TRANSACTION=303
|
||||
KW_TRANSACTIONS=304
|
||||
KW_TRANSFORM=305
|
||||
KW_TRIM=306
|
||||
KW_TRUE=307
|
||||
KW_TRUNCATE=308
|
||||
KW_TRY_CAST=309
|
||||
KW_TYPE=310
|
||||
KW_UNARCHIVE=311
|
||||
KW_UNBOUNDED=312
|
||||
KW_UNCACHE=313
|
||||
KW_UNION=314
|
||||
KW_UNIQUE=315
|
||||
KW_UNKNOWN=316
|
||||
KW_UNLOCK=317
|
||||
KW_UNPIVOT=318
|
||||
KW_UNSET=319
|
||||
KW_UPDATE=320
|
||||
KW_USE=321
|
||||
KW_USER=322
|
||||
KW_USING=323
|
||||
KW_VALUES=324
|
||||
KW_VARCHAR=325
|
||||
KW_VAR=326
|
||||
KW_VARIABLE=327
|
||||
KW_VERSION=328
|
||||
KW_VIEW=329
|
||||
KW_VIEWS=330
|
||||
KW_VOID=331
|
||||
KW_WEEK=332
|
||||
KW_WEEKS=333
|
||||
KW_WHEN=334
|
||||
KW_WHERE=335
|
||||
KW_WINDOW=336
|
||||
KW_WITH=337
|
||||
KW_WITHIN=338
|
||||
KW_YEAR=339
|
||||
KW_YEARS=340
|
||||
KW_ZONE=341
|
||||
EQ=342
|
||||
NSEQ=343
|
||||
NEQ=344
|
||||
NEQJ=345
|
||||
LT=346
|
||||
LTE=347
|
||||
GT=348
|
||||
GTE=349
|
||||
PLUS=350
|
||||
MINUS=351
|
||||
ASTERISK=352
|
||||
SLASH=353
|
||||
PERCENT=354
|
||||
TILDE=355
|
||||
AMPERSAND=356
|
||||
PIPE=357
|
||||
CONCAT_PIPE=358
|
||||
HAT=359
|
||||
COLON=360
|
||||
ARROW=361
|
||||
FAT_ARROW=362
|
||||
HENT_START=363
|
||||
HENT_END=364
|
||||
QUESTION=365
|
||||
STRING_LITERAL=366
|
||||
DOUBLEQUOTED_STRING=367
|
||||
BIGINT_LITERAL=368
|
||||
SMALLINT_LITERAL=369
|
||||
TINYINT_LITERAL=370
|
||||
INTEGER_VALUE=371
|
||||
EXPONENT_VALUE=372
|
||||
DECIMAL_VALUE=373
|
||||
FLOAT_LITERAL=374
|
||||
DOUBLE_LITERAL=375
|
||||
BIGDECIMAL_LITERAL=376
|
||||
IDENTIFIER=377
|
||||
BACKQUOTED_IDENTIFIER=378
|
||||
SIMPLE_COMMENT=379
|
||||
BRACKETED_COMMENT=380
|
||||
WS=381
|
||||
UNRECOGNIZED=382
|
||||
KW_REGEXP=245
|
||||
KW_ROLE=246
|
||||
KW_ROLES=247
|
||||
KW_ROLLBACK=248
|
||||
KW_ROLLUP=249
|
||||
KW_ROW=250
|
||||
KW_ROWS=251
|
||||
KW_SECOND=252
|
||||
KW_SECONDS=253
|
||||
KW_SCHEMA=254
|
||||
KW_SCHEMAS=255
|
||||
KW_SELECT=256
|
||||
KW_SEMI=257
|
||||
KW_SEPARATED=258
|
||||
KW_SERDE=259
|
||||
KW_SERDEPROPERTIES=260
|
||||
KW_SESSION_USER=261
|
||||
KW_SET=262
|
||||
KW_SETMINUS=263
|
||||
KW_SETS=264
|
||||
KW_SHORT=265
|
||||
KW_SHOW=266
|
||||
KW_SINGLE=267
|
||||
KW_SKEWED=268
|
||||
KW_SMALLINT=269
|
||||
KW_SOME=270
|
||||
KW_SORT=271
|
||||
KW_SORTED=272
|
||||
KW_SOURCE=273
|
||||
KW_START=274
|
||||
KW_STATISTICS=275
|
||||
KW_STORED=276
|
||||
KW_STRATIFY=277
|
||||
KW_STRING=278
|
||||
KW_STRUCT=279
|
||||
KW_SUBSTR=280
|
||||
KW_SUBSTRING=281
|
||||
KW_SYNC=282
|
||||
KW_SYSTEM=283
|
||||
KW_SYSTEM_TIME=284
|
||||
KW_SYSTEM_VERSION=285
|
||||
KW_TABLE=286
|
||||
KW_TABLES=287
|
||||
KW_TABLESAMPLE=288
|
||||
KW_TARGET=289
|
||||
KW_TBLPROPERTIES=290
|
||||
KW_TEMPORARY=291
|
||||
KW_TERMINATED=292
|
||||
KW_THEN=293
|
||||
KW_TIME=294
|
||||
KW_TIMEDIFF=295
|
||||
KW_TIMESTAMP=296
|
||||
KW_TIMESTAMP_LTZ=297
|
||||
KW_TIMESTAMP_NTZ=298
|
||||
KW_TIMESTAMPADD=299
|
||||
KW_TIMESTAMPDIFF=300
|
||||
KW_TINYINT=301
|
||||
KW_TO=302
|
||||
KW_TOUCH=303
|
||||
KW_TRAILING=304
|
||||
KW_TRANSACTION=305
|
||||
KW_TRANSACTIONS=306
|
||||
KW_TRANSFORM=307
|
||||
KW_TRIM=308
|
||||
KW_TRUE=309
|
||||
KW_TRUNCATE=310
|
||||
KW_TRY_CAST=311
|
||||
KW_TYPE=312
|
||||
KW_UNARCHIVE=313
|
||||
KW_UNBOUNDED=314
|
||||
KW_UNCACHE=315
|
||||
KW_UNION=316
|
||||
KW_UNIQUE=317
|
||||
KW_UNKNOWN=318
|
||||
KW_UNLOCK=319
|
||||
KW_UNPIVOT=320
|
||||
KW_UNSET=321
|
||||
KW_UPDATE=322
|
||||
KW_USE=323
|
||||
KW_USER=324
|
||||
KW_USING=325
|
||||
KW_VALUES=326
|
||||
KW_VARCHAR=327
|
||||
KW_VAR=328
|
||||
KW_VARIABLE=329
|
||||
KW_VERSION=330
|
||||
KW_VIEW=331
|
||||
KW_VIEWS=332
|
||||
KW_VOID=333
|
||||
KW_WEEK=334
|
||||
KW_WEEKS=335
|
||||
KW_WHEN=336
|
||||
KW_WHERE=337
|
||||
KW_WINDOW=338
|
||||
KW_WITH=339
|
||||
KW_WITHIN=340
|
||||
KW_YEAR=341
|
||||
KW_YEARS=342
|
||||
KW_ZONE=343
|
||||
EQ=344
|
||||
NSEQ=345
|
||||
NEQ=346
|
||||
NEQJ=347
|
||||
LT=348
|
||||
LTE=349
|
||||
GT=350
|
||||
GTE=351
|
||||
NOT=352
|
||||
PLUS=353
|
||||
MINUS=354
|
||||
ASTERISK=355
|
||||
SLASH=356
|
||||
PERCENT=357
|
||||
TILDE=358
|
||||
AMPERSAND=359
|
||||
PIPE=360
|
||||
CONCAT_PIPE=361
|
||||
HAT=362
|
||||
COLON=363
|
||||
ARROW=364
|
||||
FAT_ARROW=365
|
||||
HENT_START=366
|
||||
HENT_END=367
|
||||
QUESTION=368
|
||||
STRING_LITERAL=369
|
||||
DOUBLEQUOTED_STRING=370
|
||||
BIGINT_LITERAL=371
|
||||
SMALLINT_LITERAL=372
|
||||
TINYINT_LITERAL=373
|
||||
INTEGER_VALUE=374
|
||||
EXPONENT_VALUE=375
|
||||
DECIMAL_VALUE=376
|
||||
FLOAT_LITERAL=377
|
||||
DOUBLE_LITERAL=378
|
||||
BIGDECIMAL_LITERAL=379
|
||||
IDENTIFIER=380
|
||||
BACKQUOTED_IDENTIFIER=381
|
||||
SIMPLE_COMMENT=382
|
||||
BRACKETED_COMMENT=383
|
||||
WS=384
|
||||
UNRECOGNIZED=385
|
||||
';'=1
|
||||
'('=2
|
||||
')'=3
|
||||
@ -571,6 +574,7 @@ UNRECOGNIZED=382
|
||||
'NANOSECONDS'=189
|
||||
'NATURAL'=190
|
||||
'NO'=191
|
||||
'NOT'=192
|
||||
'NULL'=193
|
||||
'NULLS'=194
|
||||
'NUMERIC'=195
|
||||
@ -622,120 +626,125 @@ UNRECOGNIZED=382
|
||||
'RESTRICT'=241
|
||||
'REVOKE'=242
|
||||
'RIGHT'=243
|
||||
'ROLE'=245
|
||||
'ROLES'=246
|
||||
'ROLLBACK'=247
|
||||
'ROLLUP'=248
|
||||
'ROW'=249
|
||||
'ROWS'=250
|
||||
'SECOND'=251
|
||||
'SECONDS'=252
|
||||
'SCHEMA'=253
|
||||
'SCHEMAS'=254
|
||||
'SELECT'=255
|
||||
'SEMI'=256
|
||||
'SEPARATED'=257
|
||||
'SERDE'=258
|
||||
'SERDEPROPERTIES'=259
|
||||
'SESSION_USER'=260
|
||||
'SET'=261
|
||||
'MINUS'=262
|
||||
'SETS'=263
|
||||
'SHORT'=264
|
||||
'SHOW'=265
|
||||
'SINGLE'=266
|
||||
'SKEWED'=267
|
||||
'SMALLINT'=268
|
||||
'SOME'=269
|
||||
'SORT'=270
|
||||
'SORTED'=271
|
||||
'SOURCE'=272
|
||||
'START'=273
|
||||
'STATISTICS'=274
|
||||
'STORED'=275
|
||||
'STRATIFY'=276
|
||||
'STRING'=277
|
||||
'STRUCT'=278
|
||||
'SUBSTR'=279
|
||||
'SUBSTRING'=280
|
||||
'SYNC'=281
|
||||
'SYSTEM_TIME'=282
|
||||
'SYSTEM_VERSION'=283
|
||||
'TABLE'=284
|
||||
'TABLES'=285
|
||||
'TABLESAMPLE'=286
|
||||
'TARGET'=287
|
||||
'TBLPROPERTIES'=288
|
||||
'TERMINATED'=290
|
||||
'THEN'=291
|
||||
'TIME'=292
|
||||
'TIMEDIFF'=293
|
||||
'TIMESTAMP'=294
|
||||
'TIMESTAMP_LTZ'=295
|
||||
'TIMESTAMP_NTZ'=296
|
||||
'TIMESTAMPADD'=297
|
||||
'TIMESTAMPDIFF'=298
|
||||
'TINYINT'=299
|
||||
'TO'=300
|
||||
'TOUCH'=301
|
||||
'TRAILING'=302
|
||||
'TRANSACTION'=303
|
||||
'TRANSACTIONS'=304
|
||||
'TRANSFORM'=305
|
||||
'TRIM'=306
|
||||
'TRUE'=307
|
||||
'TRUNCATE'=308
|
||||
'TRY_CAST'=309
|
||||
'TYPE'=310
|
||||
'UNARCHIVE'=311
|
||||
'UNBOUNDED'=312
|
||||
'UNCACHE'=313
|
||||
'UNION'=314
|
||||
'UNIQUE'=315
|
||||
'UNKNOWN'=316
|
||||
'UNLOCK'=317
|
||||
'UNPIVOT'=318
|
||||
'UNSET'=319
|
||||
'UPDATE'=320
|
||||
'USE'=321
|
||||
'USER'=322
|
||||
'USING'=323
|
||||
'VALUES'=324
|
||||
'VARCHAR'=325
|
||||
'VAR'=326
|
||||
'VARIABLE'=327
|
||||
'VERSION'=328
|
||||
'VIEW'=329
|
||||
'VIEWS'=330
|
||||
'VOID'=331
|
||||
'WEEK'=332
|
||||
'WEEKS'=333
|
||||
'WHEN'=334
|
||||
'WHERE'=335
|
||||
'WINDOW'=336
|
||||
'WITH'=337
|
||||
'WITHIN'=338
|
||||
'YEAR'=339
|
||||
'YEARS'=340
|
||||
'ZONE'=341
|
||||
'<=>'=343
|
||||
'<>'=344
|
||||
'!='=345
|
||||
'<'=346
|
||||
'>'=348
|
||||
'+'=350
|
||||
'-'=351
|
||||
'*'=352
|
||||
'/'=353
|
||||
'%'=354
|
||||
'~'=355
|
||||
'&'=356
|
||||
'|'=357
|
||||
'||'=358
|
||||
'^'=359
|
||||
':'=360
|
||||
'->'=361
|
||||
'=>'=362
|
||||
'/*+'=363
|
||||
'*/'=364
|
||||
'?'=365
|
||||
'RLIKE'=244
|
||||
'REGEXP'=245
|
||||
'ROLE'=246
|
||||
'ROLES'=247
|
||||
'ROLLBACK'=248
|
||||
'ROLLUP'=249
|
||||
'ROW'=250
|
||||
'ROWS'=251
|
||||
'SECOND'=252
|
||||
'SECONDS'=253
|
||||
'SCHEMA'=254
|
||||
'SCHEMAS'=255
|
||||
'SELECT'=256
|
||||
'SEMI'=257
|
||||
'SEPARATED'=258
|
||||
'SERDE'=259
|
||||
'SERDEPROPERTIES'=260
|
||||
'SESSION_USER'=261
|
||||
'SET'=262
|
||||
'MINUS'=263
|
||||
'SETS'=264
|
||||
'SHORT'=265
|
||||
'SHOW'=266
|
||||
'SINGLE'=267
|
||||
'SKEWED'=268
|
||||
'SMALLINT'=269
|
||||
'SOME'=270
|
||||
'SORT'=271
|
||||
'SORTED'=272
|
||||
'SOURCE'=273
|
||||
'START'=274
|
||||
'STATISTICS'=275
|
||||
'STORED'=276
|
||||
'STRATIFY'=277
|
||||
'STRING'=278
|
||||
'STRUCT'=279
|
||||
'SUBSTR'=280
|
||||
'SUBSTRING'=281
|
||||
'SYNC'=282
|
||||
'SYSTEM'=283
|
||||
'SYSTEM_TIME'=284
|
||||
'SYSTEM_VERSION'=285
|
||||
'TABLE'=286
|
||||
'TABLES'=287
|
||||
'TABLESAMPLE'=288
|
||||
'TARGET'=289
|
||||
'TBLPROPERTIES'=290
|
||||
'TEMPORARY'=291
|
||||
'TERMINATED'=292
|
||||
'THEN'=293
|
||||
'TIME'=294
|
||||
'TIMEDIFF'=295
|
||||
'TIMESTAMP'=296
|
||||
'TIMESTAMP_LTZ'=297
|
||||
'TIMESTAMP_NTZ'=298
|
||||
'TIMESTAMPADD'=299
|
||||
'TIMESTAMPDIFF'=300
|
||||
'TINYINT'=301
|
||||
'TO'=302
|
||||
'TOUCH'=303
|
||||
'TRAILING'=304
|
||||
'TRANSACTION'=305
|
||||
'TRANSACTIONS'=306
|
||||
'TRANSFORM'=307
|
||||
'TRIM'=308
|
||||
'TRUE'=309
|
||||
'TRUNCATE'=310
|
||||
'TRY_CAST'=311
|
||||
'TYPE'=312
|
||||
'UNARCHIVE'=313
|
||||
'UNBOUNDED'=314
|
||||
'UNCACHE'=315
|
||||
'UNION'=316
|
||||
'UNIQUE'=317
|
||||
'UNKNOWN'=318
|
||||
'UNLOCK'=319
|
||||
'UNPIVOT'=320
|
||||
'UNSET'=321
|
||||
'UPDATE'=322
|
||||
'USE'=323
|
||||
'USER'=324
|
||||
'USING'=325
|
||||
'VALUES'=326
|
||||
'VARCHAR'=327
|
||||
'VAR'=328
|
||||
'VARIABLE'=329
|
||||
'VERSION'=330
|
||||
'VIEW'=331
|
||||
'VIEWS'=332
|
||||
'VOID'=333
|
||||
'WEEK'=334
|
||||
'WEEKS'=335
|
||||
'WHEN'=336
|
||||
'WHERE'=337
|
||||
'WINDOW'=338
|
||||
'WITH'=339
|
||||
'WITHIN'=340
|
||||
'YEAR'=341
|
||||
'YEARS'=342
|
||||
'ZONE'=343
|
||||
'<=>'=345
|
||||
'<>'=346
|
||||
'!='=347
|
||||
'<'=348
|
||||
'>'=350
|
||||
'!'=352
|
||||
'+'=353
|
||||
'-'=354
|
||||
'*'=355
|
||||
'/'=356
|
||||
'%'=357
|
||||
'~'=358
|
||||
'&'=359
|
||||
'|'=360
|
||||
'||'=361
|
||||
'^'=362
|
||||
':'=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 { ProgramContext } 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 { TimezoneContext } from "./SparkSqlParser";
|
||||
import { ConfigKeyContext } from "./SparkSqlParser";
|
||||
@ -25,8 +21,8 @@ import { InsertIntoContext } from "./SparkSqlParser";
|
||||
import { PartitionSpecLocationContext } from "./SparkSqlParser";
|
||||
import { PartitionSpecContext } from "./SparkSqlParser";
|
||||
import { PartitionValContext } from "./SparkSqlParser";
|
||||
import { NamespaceContext } from "./SparkSqlParser";
|
||||
import { NamespacesContext } from "./SparkSqlParser";
|
||||
import { DbSchemaContext } from "./SparkSqlParser";
|
||||
import { DbSchemasContext } from "./SparkSqlParser";
|
||||
import { DescribeFuncNameContext } from "./SparkSqlParser";
|
||||
import { DescribeColNameContext } from "./SparkSqlParser";
|
||||
import { CtesContext } from "./SparkSqlParser";
|
||||
@ -46,6 +42,12 @@ import { FileFormatContext } from "./SparkSqlParser";
|
||||
import { StorageHandlerContext } from "./SparkSqlParser";
|
||||
import { ResourceContext } 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 { QueryOrganizationContext } from "./SparkSqlParser";
|
||||
import { MultiInsertQueryBodyContext } from "./SparkSqlParser";
|
||||
@ -71,6 +73,7 @@ import { HavingClauseContext } from "./SparkSqlParser";
|
||||
import { HintContext } from "./SparkSqlParser";
|
||||
import { HintStatementContext } from "./SparkSqlParser";
|
||||
import { FromClauseContext } from "./SparkSqlParser";
|
||||
import { FunctionKindContext } from "./SparkSqlParser";
|
||||
import { TemporalClauseContext } from "./SparkSqlParser";
|
||||
import { AggregationClauseContext } from "./SparkSqlParser";
|
||||
import { GroupByClauseContext } from "./SparkSqlParser";
|
||||
@ -91,6 +94,8 @@ import { UnpivotNameColumnContext } from "./SparkSqlParser";
|
||||
import { UnpivotColumnAndAliasContext } from "./SparkSqlParser";
|
||||
import { UnpivotColumnContext } from "./SparkSqlParser";
|
||||
import { UnpivotAliasContext } from "./SparkSqlParser";
|
||||
import { IfNotExistsContext } from "./SparkSqlParser";
|
||||
import { IfExistsContext } from "./SparkSqlParser";
|
||||
import { LateralViewContext } from "./SparkSqlParser";
|
||||
import { SetQuantifierContext } from "./SparkSqlParser";
|
||||
import { RelationContext } from "./SparkSqlParser";
|
||||
@ -121,7 +126,7 @@ import { MultipartIdentifierContext } from "./SparkSqlParser";
|
||||
import { MultipartIdentifierPropertyListContext } from "./SparkSqlParser";
|
||||
import { MultipartIdentifierPropertyContext } from "./SparkSqlParser";
|
||||
import { TableIdentifierContext } from "./SparkSqlParser";
|
||||
import { FunctionIdentifierContext } from "./SparkSqlParser";
|
||||
import { ViewIdentifierContext } from "./SparkSqlParser";
|
||||
import { NamedExpressionContext } from "./SparkSqlParser";
|
||||
import { NamedExpressionSeqContext } from "./SparkSqlParser";
|
||||
import { PartitionFieldListContext } from "./SparkSqlParser";
|
||||
@ -175,6 +180,7 @@ import { WindowFrameContext } from "./SparkSqlParser";
|
||||
import { FrameBoundContext } from "./SparkSqlParser";
|
||||
import { QualifiedNameListContext } from "./SparkSqlParser";
|
||||
import { FunctionNameContext } from "./SparkSqlParser";
|
||||
import { FunctionNameCreateContext } from "./SparkSqlParser";
|
||||
import { QualifiedNameContext } from "./SparkSqlParser";
|
||||
import { ErrorCapturingIdentifierContext } from "./SparkSqlParser";
|
||||
import { ErrorCapturingIdentifierExtraContext } from "./SparkSqlParser";
|
||||
@ -219,50 +225,6 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
||||
*/
|
||||
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`.
|
||||
* @param ctx the parse tree
|
||||
@ -440,26 +402,26 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
exitNamespaces?: (ctx: NamespacesContext) => void;
|
||||
exitDbSchemas?: (ctx: DbSchemasContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `SparkSqlParser.describeFuncName`.
|
||||
@ -670,6 +632,72 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
||||
*/
|
||||
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`.
|
||||
* @param ctx the parse tree
|
||||
@ -945,6 +973,17 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
||||
*/
|
||||
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`.
|
||||
* @param ctx the parse tree
|
||||
@ -1165,6 +1204,28 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
||||
*/
|
||||
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`.
|
||||
* @param ctx the parse tree
|
||||
@ -1496,15 +1557,15 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
||||
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
|
||||
*/
|
||||
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
|
||||
*/
|
||||
exitFunctionIdentifier?: (ctx: FunctionIdentifierContext) => void;
|
||||
exitViewIdentifier?: (ctx: ViewIdentifierContext) => void;
|
||||
|
||||
/**
|
||||
* Enter a parse tree produced by `SparkSqlParser.namedExpression`.
|
||||
@ -2089,6 +2150,17 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
||||
*/
|
||||
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`.
|
||||
* @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 { ProgramContext } 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 { TimezoneContext } from "./SparkSqlParser";
|
||||
import { ConfigKeyContext } from "./SparkSqlParser";
|
||||
@ -25,8 +21,8 @@ import { InsertIntoContext } from "./SparkSqlParser";
|
||||
import { PartitionSpecLocationContext } from "./SparkSqlParser";
|
||||
import { PartitionSpecContext } from "./SparkSqlParser";
|
||||
import { PartitionValContext } from "./SparkSqlParser";
|
||||
import { NamespaceContext } from "./SparkSqlParser";
|
||||
import { NamespacesContext } from "./SparkSqlParser";
|
||||
import { DbSchemaContext } from "./SparkSqlParser";
|
||||
import { DbSchemasContext } from "./SparkSqlParser";
|
||||
import { DescribeFuncNameContext } from "./SparkSqlParser";
|
||||
import { DescribeColNameContext } from "./SparkSqlParser";
|
||||
import { CtesContext } from "./SparkSqlParser";
|
||||
@ -46,6 +42,12 @@ import { FileFormatContext } from "./SparkSqlParser";
|
||||
import { StorageHandlerContext } from "./SparkSqlParser";
|
||||
import { ResourceContext } 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 { QueryOrganizationContext } from "./SparkSqlParser";
|
||||
import { MultiInsertQueryBodyContext } from "./SparkSqlParser";
|
||||
@ -71,6 +73,7 @@ import { HavingClauseContext } from "./SparkSqlParser";
|
||||
import { HintContext } from "./SparkSqlParser";
|
||||
import { HintStatementContext } from "./SparkSqlParser";
|
||||
import { FromClauseContext } from "./SparkSqlParser";
|
||||
import { FunctionKindContext } from "./SparkSqlParser";
|
||||
import { TemporalClauseContext } from "./SparkSqlParser";
|
||||
import { AggregationClauseContext } from "./SparkSqlParser";
|
||||
import { GroupByClauseContext } from "./SparkSqlParser";
|
||||
@ -91,6 +94,8 @@ import { UnpivotNameColumnContext } from "./SparkSqlParser";
|
||||
import { UnpivotColumnAndAliasContext } from "./SparkSqlParser";
|
||||
import { UnpivotColumnContext } from "./SparkSqlParser";
|
||||
import { UnpivotAliasContext } from "./SparkSqlParser";
|
||||
import { IfNotExistsContext } from "./SparkSqlParser";
|
||||
import { IfExistsContext } from "./SparkSqlParser";
|
||||
import { LateralViewContext } from "./SparkSqlParser";
|
||||
import { SetQuantifierContext } from "./SparkSqlParser";
|
||||
import { RelationContext } from "./SparkSqlParser";
|
||||
@ -121,7 +126,7 @@ import { MultipartIdentifierContext } from "./SparkSqlParser";
|
||||
import { MultipartIdentifierPropertyListContext } from "./SparkSqlParser";
|
||||
import { MultipartIdentifierPropertyContext } from "./SparkSqlParser";
|
||||
import { TableIdentifierContext } from "./SparkSqlParser";
|
||||
import { FunctionIdentifierContext } from "./SparkSqlParser";
|
||||
import { ViewIdentifierContext } from "./SparkSqlParser";
|
||||
import { NamedExpressionContext } from "./SparkSqlParser";
|
||||
import { NamedExpressionSeqContext } from "./SparkSqlParser";
|
||||
import { PartitionFieldListContext } from "./SparkSqlParser";
|
||||
@ -175,6 +180,7 @@ import { WindowFrameContext } from "./SparkSqlParser";
|
||||
import { FrameBoundContext } from "./SparkSqlParser";
|
||||
import { QualifiedNameListContext } from "./SparkSqlParser";
|
||||
import { FunctionNameContext } from "./SparkSqlParser";
|
||||
import { FunctionNameCreateContext } from "./SparkSqlParser";
|
||||
import { QualifiedNameContext } from "./SparkSqlParser";
|
||||
import { ErrorCapturingIdentifierContext } from "./SparkSqlParser";
|
||||
import { ErrorCapturingIdentifierExtraContext } from "./SparkSqlParser";
|
||||
@ -214,34 +220,6 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<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`.
|
||||
* @param ctx the parse tree
|
||||
@ -355,18 +333,18 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<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
|
||||
* @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
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitNamespaces?: (ctx: NamespacesContext) => Result;
|
||||
visitDbSchemas?: (ctx: DbSchemasContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `SparkSqlParser.describeFuncName`.
|
||||
@ -501,6 +479,48 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<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`.
|
||||
* @param ctx the parse tree
|
||||
@ -676,6 +696,13 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<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`.
|
||||
* @param ctx the parse tree
|
||||
@ -816,6 +843,20 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<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`.
|
||||
* @param ctx the parse tree
|
||||
@ -1027,11 +1068,11 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<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
|
||||
* @return the visitor result
|
||||
*/
|
||||
visitFunctionIdentifier?: (ctx: FunctionIdentifierContext) => Result;
|
||||
visitViewIdentifier?: (ctx: ViewIdentifierContext) => Result;
|
||||
|
||||
/**
|
||||
* Visit a parse tree produced by `SparkSqlParser.namedExpression`.
|
||||
@ -1404,6 +1445,13 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<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`.
|
||||
* @param ctx the parse tree
|
||||
|
@ -1,9 +1,10 @@
|
||||
import { Token } from 'antlr4ts';
|
||||
import { CandidatesCollection } from 'antlr4-c3';
|
||||
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 { 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> {
|
||||
protected createLexerFormCharStream(charStreams) {
|
||||
@ -12,23 +13,112 @@ export default class SparkSQL extends BasicParser<SparkSqlLexer, ProgramContext,
|
||||
}
|
||||
|
||||
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() {
|
||||
return null as any;
|
||||
return new SparkSqlSplitListener();
|
||||
}
|
||||
|
||||
protected processCandidates(
|
||||
candidates: CandidatesCollection,
|
||||
allTokens: Token[],
|
||||
caretTokenIndex: number,
|
||||
tokenIndexOffset: number,
|
||||
): 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 {
|
||||
syntax: [],
|
||||
keywords: [],
|
||||
syntax: originalSyntaxSuggestions,
|
||||
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;
|
||||
|
||||
SELECT name, calculate_age(birthdate) AS age FROM students;
|
||||
SELECT name, calculate_age(birthday) AS age FROM students;
|
||||
|
||||
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