Feat column codeCompletion (#218)
* feat: flink support column suggestion * feat: flink column suggestion unit test * feat: hive support column suggestion * feat: hive column suggestion unit test * feat: trinosql support column suggestion * feat: trino column suggest unit test * feat: sparksql collect column suggesstion * feat: spark column suggestion unit test * feat: rebuild flinksql lib
This commit is contained in:
parent
3dadc0c4b5
commit
31a811d1bb
@ -139,9 +139,13 @@ columnOptionDefinition
|
|||||||
;
|
;
|
||||||
|
|
||||||
physicalColumnDefinition
|
physicalColumnDefinition
|
||||||
: columnName columnType columnConstraint? commentSpec?
|
: columnNameCreate columnType columnConstraint? commentSpec?
|
||||||
;
|
;
|
||||||
|
|
||||||
|
columnNameCreate
|
||||||
|
: uid
|
||||||
|
| expression;
|
||||||
|
|
||||||
columnName
|
columnName
|
||||||
: uid | expression
|
: uid | expression
|
||||||
;
|
;
|
||||||
@ -197,7 +201,7 @@ commentSpec
|
|||||||
;
|
;
|
||||||
|
|
||||||
metadataColumnDefinition
|
metadataColumnDefinition
|
||||||
: columnName columnType KW_METADATA (KW_FROM metadataKey)? KW_VIRTUAL?
|
: columnNameCreate columnType KW_METADATA (KW_FROM metadataKey)? KW_VIRTUAL?
|
||||||
;
|
;
|
||||||
|
|
||||||
metadataKey
|
metadataKey
|
||||||
@ -205,7 +209,7 @@ metadataKey
|
|||||||
;
|
;
|
||||||
|
|
||||||
computedColumnDefinition
|
computedColumnDefinition
|
||||||
: columnName KW_AS computedColumnExpression commentSpec?
|
: columnNameCreate KW_AS computedColumnExpression commentSpec?
|
||||||
;
|
;
|
||||||
|
|
||||||
// 计算表达式
|
// 计算表达式
|
||||||
@ -214,7 +218,7 @@ computedColumnExpression
|
|||||||
;
|
;
|
||||||
|
|
||||||
watermarkDefinition
|
watermarkDefinition
|
||||||
: KW_WATERMARK KW_FOR expression KW_AS expression
|
: KW_WATERMARK KW_FOR columnName KW_AS expression
|
||||||
;
|
;
|
||||||
|
|
||||||
tableConstraint
|
tableConstraint
|
||||||
@ -238,9 +242,9 @@ transformList
|
|||||||
;
|
;
|
||||||
|
|
||||||
transform
|
transform
|
||||||
: qualifiedName #identityTransform
|
: columnName #identityTransform
|
||||||
| transformName=identifier
|
| qualifiedName #columnTransform
|
||||||
LR_BRACKET transformArgument (COMMA transformArgument)* RR_BRACKET #applyTransform
|
| LR_BRACKET transformArgument (COMMA transformArgument)* RR_BRACKET #applyTransform
|
||||||
;
|
;
|
||||||
|
|
||||||
transformArgument
|
transformArgument
|
||||||
@ -424,7 +428,7 @@ selectClause
|
|||||||
|
|
||||||
projectItemDefinition
|
projectItemDefinition
|
||||||
: overWindowItem
|
: overWindowItem
|
||||||
| expression (KW_AS? expression)?
|
| columnName (KW_AS? expression )?
|
||||||
;
|
;
|
||||||
|
|
||||||
overWindowItem
|
overWindowItem
|
||||||
@ -501,12 +505,12 @@ timeIntervalParamName
|
|||||||
;
|
;
|
||||||
|
|
||||||
columnDescriptor
|
columnDescriptor
|
||||||
: KW_DESCRIPTOR LR_BRACKET uid RR_BRACKET
|
: KW_DESCRIPTOR LR_BRACKET columnName RR_BRACKET
|
||||||
;
|
;
|
||||||
|
|
||||||
joinCondition
|
joinCondition
|
||||||
: KW_ON booleanExpression
|
: KW_ON booleanExpression
|
||||||
| KW_USING LR_BRACKET uid (COMMA uid)* RR_BRACKET
|
| KW_USING columnNameList
|
||||||
;
|
;
|
||||||
|
|
||||||
whereClause
|
whereClause
|
||||||
@ -518,7 +522,7 @@ groupByClause
|
|||||||
;
|
;
|
||||||
|
|
||||||
groupItemDefinition
|
groupItemDefinition
|
||||||
: expression
|
: columnName
|
||||||
| groupWindowFunction
|
| groupWindowFunction
|
||||||
| LR_BRACKET RR_BRACKET
|
| LR_BRACKET RR_BRACKET
|
||||||
| LR_BRACKET expression (COMMA expression)* RR_BRACKET
|
| LR_BRACKET expression (COMMA expression)* RR_BRACKET
|
||||||
@ -588,7 +592,7 @@ orderByCaluse
|
|||||||
;
|
;
|
||||||
|
|
||||||
orderItemDefition
|
orderItemDefition
|
||||||
: expression ordering=(KW_ASC | KW_DESC)? (KW_NULLS nullOrder=(KW_LAST | KW_FIRST))?
|
: columnName ordering=(KW_ASC | KW_DESC)? (KW_NULLS nullOrder=(KW_LAST | KW_FIRST))?
|
||||||
;
|
;
|
||||||
|
|
||||||
limitClause
|
limitClause
|
||||||
@ -596,7 +600,7 @@ limitClause
|
|||||||
;
|
;
|
||||||
|
|
||||||
partitionByClause
|
partitionByClause
|
||||||
: KW_PARTITION KW_BY expression (COMMA expression)*
|
: KW_PARTITION KW_BY columnName (COMMA columnName)*
|
||||||
;
|
;
|
||||||
|
|
||||||
quantifiers
|
quantifiers
|
||||||
|
@ -814,11 +814,15 @@ columnNameList
|
|||||||
;
|
;
|
||||||
|
|
||||||
columnName
|
columnName
|
||||||
|
: id_ (DOT id_)*
|
||||||
|
;
|
||||||
|
|
||||||
|
columnNameCreate
|
||||||
: id_
|
: id_
|
||||||
;
|
;
|
||||||
|
|
||||||
extColumnName
|
extColumnName
|
||||||
: id_ (DOT (KW_ELEM_TYPE | KW_KEY_TYPE | KW_VALUE_TYPE | id_))*
|
: columnName (DOT (KW_ELEM_TYPE | KW_KEY_TYPE | KW_VALUE_TYPE | id_))*
|
||||||
;
|
;
|
||||||
|
|
||||||
columnNameOrderList
|
columnNameOrderList
|
||||||
@ -921,7 +925,7 @@ nullOrdering
|
|||||||
;
|
;
|
||||||
|
|
||||||
columnNameOrder
|
columnNameOrder
|
||||||
: id_ orderSpec=orderSpecification? nullSpec=nullOrdering?
|
: columnName orderSpec=orderSpecification? nullSpec=nullOrdering?
|
||||||
;
|
;
|
||||||
|
|
||||||
columnNameCommentList
|
columnNameCommentList
|
||||||
@ -929,7 +933,7 @@ columnNameCommentList
|
|||||||
;
|
;
|
||||||
|
|
||||||
columnNameComment
|
columnNameComment
|
||||||
: colName=id_ (KW_COMMENT comment=StringLiteral)?
|
: colName=columnNameCreate (KW_COMMENT comment=StringLiteral)?
|
||||||
;
|
;
|
||||||
|
|
||||||
orderSpecificationRewrite
|
orderSpecificationRewrite
|
||||||
@ -938,11 +942,11 @@ orderSpecificationRewrite
|
|||||||
;
|
;
|
||||||
|
|
||||||
columnRefOrder
|
columnRefOrder
|
||||||
: expression orderSpec=orderSpecificationRewrite? nullSpec=nullOrdering?
|
: (columnName | expression) orderSpec=orderSpecificationRewrite? nullSpec=nullOrdering?
|
||||||
;
|
;
|
||||||
|
|
||||||
columnNameType
|
columnNameType
|
||||||
: colName=id_ colType (KW_COMMENT comment=StringLiteral)?
|
: colName=columnNameCreate colType (KW_COMMENT comment=StringLiteral)?
|
||||||
;
|
;
|
||||||
|
|
||||||
columnNameTypeOrConstraint
|
columnNameTypeOrConstraint
|
||||||
@ -956,7 +960,7 @@ tableConstraint
|
|||||||
;
|
;
|
||||||
|
|
||||||
columnNameTypeConstraint
|
columnNameTypeConstraint
|
||||||
: colName=id_ colType columnConstraint? (KW_COMMENT comment=StringLiteral)?
|
: colName=columnNameCreate colType columnConstraint? (KW_COMMENT comment=StringLiteral)?
|
||||||
;
|
;
|
||||||
|
|
||||||
columnConstraint
|
columnConstraint
|
||||||
@ -1012,7 +1016,7 @@ constraintOptsAlter
|
|||||||
;
|
;
|
||||||
|
|
||||||
columnNameColonType
|
columnNameColonType
|
||||||
: colName=id_ COLON colType (KW_COMMENT comment=StringLiteral)?
|
: colName=columnNameCreate COLON colType (KW_COMMENT comment=StringLiteral)?
|
||||||
;
|
;
|
||||||
|
|
||||||
colType
|
colType
|
||||||
@ -1198,7 +1202,7 @@ deleteStatement
|
|||||||
|
|
||||||
/*SET <columName> = (3 + col2)*/
|
/*SET <columName> = (3 + col2)*/
|
||||||
columnAssignmentClause
|
columnAssignmentClause
|
||||||
: tableOrColumn EQUAL precedencePlusExpressionOrDefault
|
: columnName EQUAL precedencePlusExpressionOrDefault
|
||||||
;
|
;
|
||||||
|
|
||||||
precedencePlusExpressionOrDefault
|
precedencePlusExpressionOrDefault
|
||||||
@ -1461,12 +1465,12 @@ alterStatementSuffixDropConstraint
|
|||||||
;
|
;
|
||||||
|
|
||||||
alterStatementSuffixRenameCol
|
alterStatementSuffixRenameCol
|
||||||
: KW_CHANGE KW_COLUMN? oldName=id_ newName=id_ colType alterColumnConstraint?
|
: KW_CHANGE KW_COLUMN? oldName=columnName newName=columnNameCreate colType alterColumnConstraint?
|
||||||
(KW_COMMENT comment=StringLiteral)? alterStatementChangeColPosition? restrictOrCascade?
|
(KW_COMMENT comment=StringLiteral)? alterStatementChangeColPosition? restrictOrCascade?
|
||||||
;
|
;
|
||||||
|
|
||||||
alterStatementSuffixUpdateStatsCol
|
alterStatementSuffixUpdateStatsCol
|
||||||
: KW_UPDATE KW_STATISTICS KW_FOR KW_COLUMN? colName=id_ KW_SET tableProperties (KW_COMMENT comment=StringLiteral)?
|
: KW_UPDATE KW_STATISTICS KW_FOR KW_COLUMN? colName=columnName KW_SET tableProperties (KW_COMMENT comment=StringLiteral)?
|
||||||
;
|
;
|
||||||
|
|
||||||
alterStatementSuffixUpdateStats
|
alterStatementSuffixUpdateStats
|
||||||
@ -1574,7 +1578,7 @@ alterStatementSuffixRenamePart
|
|||||||
;
|
;
|
||||||
|
|
||||||
alterStatementSuffixStatsPart
|
alterStatementSuffixStatsPart
|
||||||
: KW_UPDATE KW_STATISTICS KW_FOR KW_COLUMN? colName=id_ KW_SET tableProperties (KW_COMMENT comment=StringLiteral)?
|
: KW_UPDATE KW_STATISTICS KW_FOR KW_COLUMN? colName=columnName KW_SET tableProperties (KW_COMMENT comment=StringLiteral)?
|
||||||
;
|
;
|
||||||
|
|
||||||
alterStatementSuffixMergeFiles
|
alterStatementSuffixMergeFiles
|
||||||
@ -1718,11 +1722,6 @@ tableAllColumns
|
|||||||
| tableOrView DOT STAR
|
| tableOrView DOT STAR
|
||||||
;
|
;
|
||||||
|
|
||||||
// (table|column)
|
|
||||||
tableOrColumn
|
|
||||||
: id_
|
|
||||||
;
|
|
||||||
|
|
||||||
defaultValue
|
defaultValue
|
||||||
: KW_DEFAULT
|
: KW_DEFAULT
|
||||||
;
|
;
|
||||||
@ -1964,7 +1963,7 @@ selectTrfmClause
|
|||||||
|
|
||||||
selectItem
|
selectItem
|
||||||
: tableAllColumns
|
: tableAllColumns
|
||||||
| (expression (KW_AS? id_ | KW_AS LPAREN id_ (COMMA id_)* RPAREN)?)
|
| ((columnName | expression) (KW_AS? id_ | KW_AS LPAREN id_ (COMMA id_)* RPAREN)?)
|
||||||
;
|
;
|
||||||
|
|
||||||
trfmClause
|
trfmClause
|
||||||
@ -2035,7 +2034,8 @@ groupByClause
|
|||||||
|
|
||||||
// support for new and old rollup/cube syntax
|
// support for new and old rollup/cube syntax
|
||||||
groupby_expression
|
groupby_expression
|
||||||
: rollupStandard
|
: columnName
|
||||||
|
| rollupStandard
|
||||||
| rollupOldSyntax
|
| rollupOldSyntax
|
||||||
| groupByEmpty
|
| groupByEmpty
|
||||||
;
|
;
|
||||||
@ -2339,8 +2339,8 @@ atomExpression
|
|||||||
| whenExpression
|
| whenExpression
|
||||||
| subQueryExpression
|
| subQueryExpression
|
||||||
| function_
|
| function_
|
||||||
| tableOrColumn
|
|
||||||
| expressionsInParenthesis
|
| expressionsInParenthesis
|
||||||
|
| id_
|
||||||
;
|
;
|
||||||
|
|
||||||
precedenceFieldExpression
|
precedenceFieldExpression
|
||||||
|
@ -238,6 +238,7 @@ KW_NANOSECOND: 'NANOSECOND';
|
|||||||
KW_NANOSECONDS: 'NANOSECONDS';
|
KW_NANOSECONDS: 'NANOSECONDS';
|
||||||
KW_NATURAL: 'NATURAL';
|
KW_NATURAL: 'NATURAL';
|
||||||
KW_NO: 'NO';
|
KW_NO: 'NO';
|
||||||
|
KW_NOSCAN: 'NOSCAN';
|
||||||
KW_NOT: 'NOT';
|
KW_NOT: 'NOT';
|
||||||
KW_NULL: 'NULL';
|
KW_NULL: 'NULL';
|
||||||
KW_NULLS: 'NULLS';
|
KW_NULLS: 'NULLS';
|
||||||
|
@ -22,30 +22,6 @@ parser grammar SparkSqlParser;
|
|||||||
|
|
||||||
options { tokenVocab = SparkSqlLexer; }
|
options { tokenVocab = SparkSqlLexer; }
|
||||||
|
|
||||||
@members {
|
|
||||||
/**
|
|
||||||
* When false, KW_INTERSECT is given the greater precedence over the other set
|
|
||||||
* operations (KW_UNION, KW_EXCEPT and MINUS) as per the SQL standard.
|
|
||||||
*/
|
|
||||||
public legacy_setops_precedence_enabled = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When false, a literal with an exponent would be converted into
|
|
||||||
* double type rather than decimal type.
|
|
||||||
*/
|
|
||||||
public legacy_exponent_literal_as_decimal_enabled = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When true, the behavior of keywords follows ANSI SQL standard.
|
|
||||||
*/
|
|
||||||
public SQL_standard_keyword_behavior = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When true, double quoted literals are identifiers rather than STRINGs.
|
|
||||||
*/
|
|
||||||
public double_quoted_identifiers = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
program
|
program
|
||||||
: singleStatement* EOF
|
: singleStatement* EOF
|
||||||
;
|
;
|
||||||
@ -86,24 +62,19 @@ statement
|
|||||||
createTableClauses
|
createTableClauses
|
||||||
(KW_AS? query)?
|
(KW_AS? query)?
|
||||||
| KW_ANALYZE KW_TABLE tableName 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_NOSCAN | KW_FOR KW_COLUMNS columnNameSeq | KW_FOR KW_ALL KW_COLUMNS)?
|
||||||
| KW_ANALYZE KW_TABLES ((KW_FROM | KW_IN) dbSchemaName)? KW_COMPUTE KW_STATISTICS
|
| KW_ANALYZE KW_TABLES ((KW_FROM | KW_IN) dbSchemaName)? KW_COMPUTE KW_STATISTICS
|
||||||
(identifier)?
|
(KW_NOSCAN)?
|
||||||
| KW_ALTER KW_TABLE tableName
|
| KW_ALTER KW_TABLE tableName
|
||||||
KW_ADD (KW_COLUMN | KW_COLUMNS)
|
KW_ADD KW_COLUMN qualifiedColTypeWithPositionForAdd
|
||||||
qualifiedColTypeWithPositionList
|
|
||||||
| KW_ALTER KW_TABLE tableName
|
| KW_ALTER KW_TABLE tableName
|
||||||
KW_ADD (KW_COLUMN | KW_COLUMNS)
|
KW_ADD KW_COLUMNS LEFT_PAREN qualifiedColTypeWithPositionSeqForAdd RIGHT_PAREN
|
||||||
LEFT_PAREN qualifiedColTypeWithPositionList RIGHT_PAREN
|
|
||||||
| KW_ALTER KW_TABLE table=tableName
|
| KW_ALTER KW_TABLE table=tableName
|
||||||
KW_RENAME KW_COLUMN
|
KW_RENAME KW_COLUMN columnName KW_TO columnNameCreate
|
||||||
multipartIdentifier KW_TO errorCapturingIdentifier
|
|
||||||
| KW_ALTER KW_TABLE tableName
|
| KW_ALTER KW_TABLE tableName
|
||||||
KW_DROP (KW_COLUMN | KW_COLUMNS) (ifExists)?
|
KW_DROP KW_COLUMN (ifExists)? columnName
|
||||||
LEFT_PAREN multipartIdentifierList RIGHT_PAREN
|
|
||||||
| KW_ALTER KW_TABLE tableName
|
| KW_ALTER KW_TABLE tableName
|
||||||
KW_DROP (KW_COLUMN | KW_COLUMNS) (ifExists)?
|
KW_DROP KW_COLUMNS (ifExists)? LEFT_PAREN columnNameSeq RIGHT_PAREN
|
||||||
multipartIdentifierList
|
|
||||||
| KW_ALTER (KW_TABLE tableName | KW_VIEW viewName)
|
| KW_ALTER (KW_TABLE tableName | KW_VIEW viewName)
|
||||||
KW_RENAME KW_TO multipartIdentifier
|
KW_RENAME KW_TO multipartIdentifier
|
||||||
| KW_ALTER (KW_TABLE tableName | KW_VIEW viewName)
|
| KW_ALTER (KW_TABLE tableName | KW_VIEW viewName)
|
||||||
@ -111,14 +82,14 @@ statement
|
|||||||
| KW_ALTER (KW_TABLE tableName | KW_VIEW viewName)
|
| KW_ALTER (KW_TABLE tableName | KW_VIEW viewName)
|
||||||
KW_UNSET KW_TBLPROPERTIES (ifExists)? propertyList
|
KW_UNSET KW_TBLPROPERTIES (ifExists)? propertyList
|
||||||
| KW_ALTER KW_TABLE table=tableName
|
| KW_ALTER KW_TABLE table=tableName
|
||||||
(KW_ALTER | KW_CHANGE) KW_COLUMN? column=multipartIdentifier
|
(KW_ALTER | KW_CHANGE) KW_COLUMN? column=columnName
|
||||||
alterColumnAction?
|
alterColumnAction?
|
||||||
| KW_ALTER KW_TABLE table=tableName partitionSpec?
|
| KW_ALTER KW_TABLE table=tableName partitionSpec?
|
||||||
KW_CHANGE KW_COLUMN?
|
KW_CHANGE KW_COLUMN?
|
||||||
colName=multipartIdentifier colType colPosition?
|
colName=columnName colType colPosition?
|
||||||
| KW_ALTER KW_TABLE table=tableName partitionSpec?
|
| KW_ALTER KW_TABLE table=tableName partitionSpec?
|
||||||
KW_REPLACE KW_COLUMNS
|
KW_REPLACE KW_COLUMNS
|
||||||
LEFT_PAREN qualifiedColTypeWithPositionList
|
LEFT_PAREN qualifiedColTypeWithPositionSeqForReplace
|
||||||
RIGHT_PAREN
|
RIGHT_PAREN
|
||||||
| KW_ALTER KW_TABLE tableName (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)?
|
||||||
@ -162,7 +133,7 @@ statement
|
|||||||
| KW_SHOW KW_TBLPROPERTIES table=tableName
|
| 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=tableName
|
| KW_SHOW KW_COLUMNS (KW_FROM | KW_IN) table=tableName
|
||||||
((KW_FROM | KW_IN) multipartIdentifier)?
|
((KW_FROM | KW_IN) dbSchemaName)?
|
||||||
| KW_SHOW KW_VIEWS ((KW_FROM | KW_IN) dbSchemaName)?
|
| KW_SHOW KW_VIEWS ((KW_FROM | KW_IN) dbSchemaName)?
|
||||||
(KW_LIKE? pattern=stringLit)?
|
(KW_LIKE? pattern=stringLit)?
|
||||||
| KW_SHOW KW_PARTITIONS tableName partitionSpec?
|
| KW_SHOW KW_PARTITIONS tableName partitionSpec?
|
||||||
@ -306,8 +277,8 @@ query
|
|||||||
;
|
;
|
||||||
|
|
||||||
insertInto
|
insertInto
|
||||||
: KW_INSERT KW_OVERWRITE KW_TABLE? tableName (partitionSpec (ifNotExists)?)? ((KW_BY KW_NAME) | identifierList)?
|
: KW_INSERT KW_OVERWRITE KW_TABLE? tableName (partitionSpec (ifNotExists)?)? ((KW_BY KW_NAME) | (LEFT_PAREN columnNameSeq RIGHT_PAREN ))?
|
||||||
| KW_INSERT KW_INTO KW_TABLE? tableName partitionSpec? (ifNotExists)? ((KW_BY KW_NAME) | identifierList)?
|
| KW_INSERT KW_INTO KW_TABLE? tableName partitionSpec? (ifNotExists)? ((KW_BY KW_NAME) | (LEFT_PAREN columnNameSeq RIGHT_PAREN ))?
|
||||||
| KW_INSERT KW_INTO KW_TABLE? tableName 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)?
|
||||||
@ -443,11 +414,22 @@ dmlStatementNoWith
|
|||||||
;
|
;
|
||||||
|
|
||||||
dbSchemaName: identifierReference;
|
dbSchemaName: identifierReference;
|
||||||
|
|
||||||
dbSchemaNameCreate: identifierReference;
|
dbSchemaNameCreate: identifierReference;
|
||||||
tableNameCreate : tableIdentifier;
|
|
||||||
tableName : tableIdentifier;
|
tableNameCreate: tableIdentifier;
|
||||||
viewNameCreate : viewIdentifier;
|
|
||||||
viewName : viewIdentifier;
|
tableName: tableIdentifier;
|
||||||
|
|
||||||
|
viewNameCreate: viewIdentifier;
|
||||||
|
|
||||||
|
viewName: viewIdentifier;
|
||||||
|
|
||||||
|
columnName: multipartIdentifier;
|
||||||
|
|
||||||
|
columnNameSeq: columnName (COMMA columnName)* ;
|
||||||
|
|
||||||
|
columnNameCreate: errorCapturingIdentifier;
|
||||||
|
|
||||||
identifierReference
|
identifierReference
|
||||||
: KW_IDENTIFIER LEFT_PAREN expression RIGHT_PAREN
|
: KW_IDENTIFIER LEFT_PAREN expression RIGHT_PAREN
|
||||||
@ -470,11 +452,11 @@ multiInsertQueryBody
|
|||||||
|
|
||||||
queryTerm
|
queryTerm
|
||||||
: queryPrimary
|
: queryPrimary
|
||||||
| left=queryTerm {this.legacy_setops_precedence_enabled}?
|
| left=queryTerm
|
||||||
operator=(KW_INTERSECT | KW_UNION | KW_EXCEPT | KW_MINUS) setQuantifier? right=queryTerm
|
operator=(KW_INTERSECT | KW_UNION | KW_EXCEPT | KW_MINUS) setQuantifier? right=queryTerm
|
||||||
| left=queryTerm {!this.legacy_setops_precedence_enabled}?
|
| left=queryTerm
|
||||||
operator=KW_INTERSECT setQuantifier? right=queryTerm
|
operator=KW_INTERSECT setQuantifier? right=queryTerm
|
||||||
| left=queryTerm {!this.legacy_setops_precedence_enabled}?
|
| left=queryTerm
|
||||||
operator=(KW_UNION | KW_EXCEPT | KW_MINUS) setQuantifier? right=queryTerm
|
operator=(KW_UNION | KW_EXCEPT | KW_MINUS) setQuantifier? right=queryTerm
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -487,7 +469,7 @@ queryPrimary
|
|||||||
;
|
;
|
||||||
|
|
||||||
sortItem
|
sortItem
|
||||||
: expression ordering=(KW_ASC | KW_DESC)? (KW_NULLS nullOrder=(KW_LAST | KW_FIRST))?
|
: (columnName | expression) ordering=(KW_ASC | KW_DESC)? (KW_NULLS nullOrder=(KW_LAST | KW_FIRST))?
|
||||||
;
|
;
|
||||||
|
|
||||||
fromStatement
|
fromStatement
|
||||||
@ -620,7 +602,8 @@ aggregationClause
|
|||||||
;
|
;
|
||||||
|
|
||||||
groupByClause
|
groupByClause
|
||||||
: groupingAnalytics
|
: columnName
|
||||||
|
| groupingAnalytics
|
||||||
| expression
|
| expression
|
||||||
;
|
;
|
||||||
|
|
||||||
@ -635,8 +618,9 @@ groupingElement
|
|||||||
;
|
;
|
||||||
|
|
||||||
groupingSet
|
groupingSet
|
||||||
: LEFT_PAREN (expression (COMMA expression)*)? RIGHT_PAREN
|
: columnName
|
||||||
| expression
|
| expression
|
||||||
|
| LEFT_PAREN ((columnName | expression) (COMMA (columnName | expression))*)? RIGHT_PAREN
|
||||||
;
|
;
|
||||||
|
|
||||||
pivotClause
|
pivotClause
|
||||||
@ -870,7 +854,7 @@ viewIdentifier
|
|||||||
;
|
;
|
||||||
|
|
||||||
namedExpression
|
namedExpression
|
||||||
: expression (KW_AS? (name=errorCapturingIdentifier | identifierList))?
|
: (columnName | expression) (KW_AS? (name=errorCapturingIdentifier | identifierList))?
|
||||||
;
|
;
|
||||||
|
|
||||||
namedExpressionSeq
|
namedExpressionSeq
|
||||||
@ -1097,14 +1081,23 @@ dataType
|
|||||||
(COMMA INTEGER_VALUE)* RIGHT_PAREN)?
|
(COMMA INTEGER_VALUE)* RIGHT_PAREN)?
|
||||||
;
|
;
|
||||||
|
|
||||||
qualifiedColTypeWithPositionList
|
qualifiedColTypeWithPositionSeqForAdd
|
||||||
: qualifiedColTypeWithPosition (COMMA qualifiedColTypeWithPosition)*
|
: qualifiedColTypeWithPositionForAdd (COMMA qualifiedColTypeWithPositionForAdd)*
|
||||||
;
|
;
|
||||||
|
|
||||||
qualifiedColTypeWithPosition
|
qualifiedColTypeWithPositionForAdd
|
||||||
: name=multipartIdentifier dataType colDefinitionDescriptorWithPosition*
|
: name=columnNameCreate dataType colDefinitionDescriptorWithPosition*
|
||||||
;
|
;
|
||||||
|
|
||||||
|
qualifiedColTypeWithPositionSeqForReplace
|
||||||
|
: qualifiedColTypeWithPositionForReplace (COMMA qualifiedColTypeWithPositionForReplace)*
|
||||||
|
;
|
||||||
|
|
||||||
|
qualifiedColTypeWithPositionForReplace
|
||||||
|
: name=columnName dataType colDefinitionDescriptorWithPosition*
|
||||||
|
;
|
||||||
|
|
||||||
|
|
||||||
colDefinitionDescriptorWithPosition
|
colDefinitionDescriptorWithPosition
|
||||||
: KW_NOT KW_NULL
|
: KW_NOT KW_NULL
|
||||||
| defaultExpression
|
| defaultExpression
|
||||||
@ -1133,7 +1126,7 @@ createOrReplaceTableColTypeList
|
|||||||
;
|
;
|
||||||
|
|
||||||
createOrReplaceTableColType
|
createOrReplaceTableColType
|
||||||
: colName=errorCapturingIdentifier dataType colDefinitionOption*
|
: colName=columnNameCreate dataType colDefinitionOption*
|
||||||
;
|
;
|
||||||
|
|
||||||
colDefinitionOption
|
colDefinitionOption
|
||||||
@ -1230,19 +1223,19 @@ errorCapturingIdentifierExtra
|
|||||||
|
|
||||||
identifier
|
identifier
|
||||||
: strictIdentifier
|
: strictIdentifier
|
||||||
| {!this.SQL_standard_keyword_behavior}? strictNonReserved
|
| strictNonReserved
|
||||||
;
|
;
|
||||||
|
|
||||||
strictIdentifier
|
strictIdentifier
|
||||||
: IDENTIFIER
|
: IDENTIFIER
|
||||||
| quotedIdentifier
|
| quotedIdentifier
|
||||||
| {this.SQL_standard_keyword_behavior}? ansiNonReserved
|
| ansiNonReserved
|
||||||
| {!this.SQL_standard_keyword_behavior}? nonReserved
|
| nonReserved
|
||||||
;
|
;
|
||||||
|
|
||||||
quotedIdentifier
|
quotedIdentifier
|
||||||
: BACKQUOTED_IDENTIFIER
|
: BACKQUOTED_IDENTIFIER
|
||||||
| {this.double_quoted_identifiers}? DOUBLEQUOTED_STRING
|
| DOUBLEQUOTED_STRING
|
||||||
;
|
;
|
||||||
|
|
||||||
backQuotedIdentifier
|
backQuotedIdentifier
|
||||||
@ -1250,9 +1243,9 @@ backQuotedIdentifier
|
|||||||
;
|
;
|
||||||
|
|
||||||
number
|
number
|
||||||
: {!this.legacy_exponent_literal_as_decimal_enabled}? MINUS? EXPONENT_VALUE
|
: MINUS? EXPONENT_VALUE
|
||||||
| {!this.legacy_exponent_literal_as_decimal_enabled}? MINUS? DECIMAL_VALUE
|
| MINUS? DECIMAL_VALUE
|
||||||
| {this.legacy_exponent_literal_as_decimal_enabled}? MINUS? (EXPONENT_VALUE | DECIMAL_VALUE)
|
| MINUS? (EXPONENT_VALUE | DECIMAL_VALUE)
|
||||||
| MINUS? INTEGER_VALUE
|
| MINUS? INTEGER_VALUE
|
||||||
| MINUS? BIGINT_LITERAL
|
| MINUS? BIGINT_LITERAL
|
||||||
| MINUS? SMALLINT_LITERAL
|
| MINUS? SMALLINT_LITERAL
|
||||||
@ -1273,7 +1266,7 @@ alterColumnAction
|
|||||||
|
|
||||||
stringLit
|
stringLit
|
||||||
: STRING_LITERAL
|
: STRING_LITERAL
|
||||||
| {!this.double_quoted_identifiers}? DOUBLEQUOTED_STRING
|
| DOUBLEQUOTED_STRING
|
||||||
;
|
;
|
||||||
|
|
||||||
comment
|
comment
|
||||||
|
@ -52,7 +52,7 @@ statement:
|
|||||||
| KW_DROP KW_SCHEMA (KW_IF KW_EXISTS)? schemaName (KW_CASCADE | KW_RESTRICT)? # dropSchema
|
| KW_DROP KW_SCHEMA (KW_IF KW_EXISTS)? schemaName (KW_CASCADE | KW_RESTRICT)? # dropSchema
|
||||||
| KW_ALTER KW_SCHEMA schemaName KW_RENAME KW_TO schemaNameCreate # renameSchema
|
| KW_ALTER KW_SCHEMA schemaName KW_RENAME KW_TO schemaNameCreate # renameSchema
|
||||||
| KW_ALTER KW_SCHEMA schemaName KW_SET KW_AUTHORIZATION principal # setSchemaAuthorization
|
| KW_ALTER KW_SCHEMA schemaName KW_SET KW_AUTHORIZATION principal # setSchemaAuthorization
|
||||||
| KW_CREATE KW_TABLE (KW_IF KW_NOT KW_EXISTS)? tableNameCreate columnAliases? (
|
| KW_CREATE KW_TABLE (KW_IF KW_NOT KW_EXISTS)? tableNameCreate columnListCreate? (
|
||||||
KW_COMMENT string
|
KW_COMMENT string
|
||||||
)? (KW_WITH properties)? KW_AS (query | '(' query ')') (
|
)? (KW_WITH properties)? KW_AS (query | '(' query ')') (
|
||||||
KW_WITH (KW_NO)? KW_DATA
|
KW_WITH (KW_NO)? KW_DATA
|
||||||
@ -61,18 +61,18 @@ statement:
|
|||||||
',' tableElement
|
',' tableElement
|
||||||
)* ')' (KW_COMMENT string)? (KW_WITH properties)? # createTable
|
)* ')' (KW_COMMENT string)? (KW_WITH properties)? # createTable
|
||||||
| KW_DROP KW_TABLE (KW_IF KW_EXISTS)? tableName # dropTable
|
| KW_DROP KW_TABLE (KW_IF KW_EXISTS)? tableName # dropTable
|
||||||
| KW_INSERT KW_INTO tableName columnAliases? query # insertInto
|
| KW_INSERT KW_INTO tableName columnList? query # insertInto
|
||||||
| KW_DELETE KW_FROM tableName (KW_WHERE booleanExpression)? # delete
|
| KW_DELETE KW_FROM tableName (KW_WHERE booleanExpression)? # delete
|
||||||
| KW_TRUNCATE KW_TABLE tableName # truncateTable
|
| KW_TRUNCATE KW_TABLE tableName # truncateTable
|
||||||
| KW_ALTER KW_TABLE (KW_IF KW_EXISTS)? from = tableName KW_RENAME KW_TO to = tableNameCreate # renameTable
|
| KW_ALTER KW_TABLE (KW_IF KW_EXISTS)? from = tableName KW_RENAME KW_TO to = tableNameCreate # renameTable
|
||||||
| KW_COMMENT KW_ON KW_TABLE tableName KW_IS (string | KW_NULL) # commentTable
|
| KW_COMMENT KW_ON KW_TABLE tableName KW_IS (string | KW_NULL) # commentTable
|
||||||
| KW_COMMENT KW_ON KW_COLUMN qualifiedName KW_IS (string | KW_NULL) # commentColumn
|
| KW_COMMENT KW_ON KW_COLUMN columnName KW_IS (string | KW_NULL) # commentColumn
|
||||||
| KW_ALTER KW_TABLE (KW_IF KW_EXISTS)? tableName KW_RENAME KW_COLUMN (
|
| KW_ALTER KW_TABLE (KW_IF KW_EXISTS)? tableName KW_RENAME KW_COLUMN (
|
||||||
KW_IF KW_EXISTS
|
KW_IF KW_EXISTS
|
||||||
)? from = identifier KW_TO to = identifier # renameColumn
|
)? from = columnName KW_TO to = columnNameCreate # renameColumn
|
||||||
| KW_ALTER KW_TABLE (KW_IF KW_EXISTS)? tableName KW_DROP KW_COLUMN (
|
| KW_ALTER KW_TABLE (KW_IF KW_EXISTS)? tableName KW_DROP KW_COLUMN (
|
||||||
KW_IF KW_EXISTS
|
KW_IF KW_EXISTS
|
||||||
)? column = qualifiedName # dropColumn
|
)? column = columnName # dropColumn
|
||||||
| KW_ALTER KW_TABLE (KW_IF KW_EXISTS)? tableName KW_ADD KW_COLUMN (
|
| KW_ALTER KW_TABLE (KW_IF KW_EXISTS)? tableName KW_ADD KW_COLUMN (
|
||||||
KW_IF KW_NOT KW_EXISTS
|
KW_IF KW_NOT KW_EXISTS
|
||||||
)? column = columnDefinition # addColumn
|
)? column = columnDefinition # addColumn
|
||||||
@ -173,7 +173,7 @@ statement:
|
|||||||
)* (KW_WHERE where = booleanExpression)? # update
|
)* (KW_WHERE where = booleanExpression)? # update
|
||||||
| KW_MERGE KW_INTO tableName (KW_AS? identifier)? KW_USING relation KW_ON expression mergeCase+ # merge
|
| KW_MERGE KW_INTO tableName (KW_AS? identifier)? KW_USING relation KW_ON expression mergeCase+ # merge
|
||||||
| KW_SHOW KW_COMMENT KW_ON KW_TABLE tableName # showTableComment
|
| KW_SHOW KW_COMMENT KW_ON KW_TABLE tableName # showTableComment
|
||||||
| KW_SHOW KW_COMMENT KW_ON KW_COLUMN qualifiedName # showColumnComment;
|
| KW_SHOW KW_COMMENT KW_ON KW_COLUMN columnName # showColumnComment;
|
||||||
|
|
||||||
query: with? queryNoWith;
|
query: with? queryNoWith;
|
||||||
|
|
||||||
@ -182,7 +182,7 @@ with: KW_WITH KW_RECURSIVE? namedQuery (',' namedQuery)*;
|
|||||||
tableElement: columnDefinition | likeClause;
|
tableElement: columnDefinition | likeClause;
|
||||||
|
|
||||||
columnDefinition:
|
columnDefinition:
|
||||||
identifier type (KW_NOT KW_NULL)? (KW_COMMENT string)? (
|
columnNameCreate type (KW_NOT KW_NULL)? (KW_COMMENT string)? (
|
||||||
KW_WITH properties
|
KW_WITH properties
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
@ -230,7 +230,7 @@ queryPrimary:
|
|||||||
| '(' queryNoWith ')' # subquery;
|
| '(' queryNoWith ')' # subquery;
|
||||||
|
|
||||||
sortItem:
|
sortItem:
|
||||||
expression ordering = (KW_ASC | KW_DESC)? (
|
(columnName | expression) ordering = (KW_ASC | KW_DESC)? (
|
||||||
KW_NULLS nullOrdering = (KW_FIRST | KW_LAST)
|
KW_NULLS nullOrdering = (KW_FIRST | KW_LAST)
|
||||||
)?;
|
)?;
|
||||||
|
|
||||||
@ -245,12 +245,16 @@ groupBy: setQuantifier? groupingElement (',' groupingElement)*;
|
|||||||
|
|
||||||
groupingElement:
|
groupingElement:
|
||||||
groupingSet # singleGroupingSet
|
groupingSet # singleGroupingSet
|
||||||
| KW_ROLLUP '(' (expression (',' expression)*)? ')' # rollup
|
| KW_ROLLUP '(' (groupingTerm (',' groupingTerm)*)? ')' # rollup
|
||||||
| KW_CUBE '(' (expression (',' expression)*)? ')' # cube
|
| KW_CUBE '(' (groupingTerm (',' groupingTerm)*)? ')' # cube
|
||||||
| KW_GROUPING KW_SETS '(' groupingSet (',' groupingSet)* ')' # multipleGroupingSets;
|
| KW_GROUPING KW_SETS '(' groupingSet (',' groupingSet)* ')' # multipleGroupingSets;
|
||||||
|
|
||||||
groupingSet:
|
groupingSet:
|
||||||
'(' (expression (',' expression)*)? ')'
|
'(' (groupingTerm (',' groupingTerm)*)? ')'
|
||||||
|
| groupingTerm;
|
||||||
|
|
||||||
|
groupingTerm:
|
||||||
|
columnName
|
||||||
| expression;
|
| expression;
|
||||||
|
|
||||||
windowDefinition:
|
windowDefinition:
|
||||||
@ -267,7 +271,7 @@ namedQuery: name = identifier (columnAliases)? KW_AS '(' query ')';
|
|||||||
setQuantifier: KW_DISTINCT | KW_ALL;
|
setQuantifier: KW_DISTINCT | KW_ALL;
|
||||||
|
|
||||||
selectItem:
|
selectItem:
|
||||||
expression (KW_AS? identifier)? # selectSingle
|
(columnName | expression) (KW_AS? identifier)? # selectSingle
|
||||||
| primaryExpression '.' ASTERISK (KW_AS columnAliases)? # selectAll
|
| primaryExpression '.' ASTERISK (KW_AS columnAliases)? # selectAll
|
||||||
| ASTERISK # selectAll;
|
| ASTERISK # selectAll;
|
||||||
|
|
||||||
@ -335,6 +339,10 @@ variableDefinition: identifier KW_AS expression;
|
|||||||
aliasedRelation:
|
aliasedRelation:
|
||||||
relationPrimary (KW_AS? identifier columnAliases?)?;
|
relationPrimary (KW_AS? identifier columnAliases?)?;
|
||||||
|
|
||||||
|
columnListCreate: '(' columnNameCreate (',' columnNameCreate)* ')';
|
||||||
|
|
||||||
|
columnList: '(' columnName (',' columnName)* ')';
|
||||||
|
|
||||||
columnAliases: '(' identifier (',' identifier)* ')';
|
columnAliases: '(' identifier (',' identifier)* ')';
|
||||||
|
|
||||||
relationPrimary:
|
relationPrimary:
|
||||||
@ -611,6 +619,10 @@ catalogNameCreate: catalog = identifier;
|
|||||||
|
|
||||||
functionName: qualifiedName;
|
functionName: qualifiedName;
|
||||||
|
|
||||||
|
columnName: qualifiedName ;
|
||||||
|
|
||||||
|
columnNameCreate: identifier;
|
||||||
|
|
||||||
qualifiedName: identifier ('.' identifier)*;
|
qualifiedName: identifier ('.' identifier)*;
|
||||||
|
|
||||||
grantor:
|
grantor:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Generated from /Users/liuyi/Desktop/Projects/dtstack/dt-sql-parser/src/grammar/flinksql/FlinkSqlLexer.g4 by ANTLR 4.9.0-SNAPSHOT
|
// Generated from /Users/hayden/Desktop/dt-works/dt-sql-parser/src/grammar/flinksql/FlinkSqlLexer.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||||
|
|
||||||
|
|
||||||
import { ATN } from "antlr4ts/atn/ATN";
|
import { ATN } from "antlr4ts/atn/ATN";
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
|||||||
// Generated from /Users/liuyi/Desktop/Projects/dtstack/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
// Generated from /Users/hayden/Desktop/dt-works/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||||
|
|
||||||
|
|
||||||
import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener";
|
import { ParseTreeListener } from "antlr4ts/tree/ParseTreeListener";
|
||||||
@ -28,6 +28,7 @@ import { DateFunctionExpressionContext } from "./FlinkSqlParser";
|
|||||||
import { ErrorIdentContext } from "./FlinkSqlParser";
|
import { ErrorIdentContext } from "./FlinkSqlParser";
|
||||||
import { RealIdentContext } from "./FlinkSqlParser";
|
import { RealIdentContext } from "./FlinkSqlParser";
|
||||||
import { IdentityTransformContext } from "./FlinkSqlParser";
|
import { IdentityTransformContext } from "./FlinkSqlParser";
|
||||||
|
import { ColumnTransformContext } from "./FlinkSqlParser";
|
||||||
import { ApplyTransformContext } from "./FlinkSqlParser";
|
import { ApplyTransformContext } from "./FlinkSqlParser";
|
||||||
import { LogicalNotContext } from "./FlinkSqlParser";
|
import { LogicalNotContext } from "./FlinkSqlParser";
|
||||||
import { ExistsContext } from "./FlinkSqlParser";
|
import { ExistsContext } from "./FlinkSqlParser";
|
||||||
@ -60,6 +61,7 @@ import { SimpleCreateTableContext } from "./FlinkSqlParser";
|
|||||||
import { CreateTableAsSelectContext } from "./FlinkSqlParser";
|
import { CreateTableAsSelectContext } from "./FlinkSqlParser";
|
||||||
import { ColumnOptionDefinitionContext } from "./FlinkSqlParser";
|
import { ColumnOptionDefinitionContext } from "./FlinkSqlParser";
|
||||||
import { PhysicalColumnDefinitionContext } from "./FlinkSqlParser";
|
import { PhysicalColumnDefinitionContext } from "./FlinkSqlParser";
|
||||||
|
import { ColumnNameCreateContext } from "./FlinkSqlParser";
|
||||||
import { ColumnNameContext } from "./FlinkSqlParser";
|
import { ColumnNameContext } from "./FlinkSqlParser";
|
||||||
import { ColumnNameListContext } from "./FlinkSqlParser";
|
import { ColumnNameListContext } from "./FlinkSqlParser";
|
||||||
import { ColumnTypeContext } from "./FlinkSqlParser";
|
import { ColumnTypeContext } from "./FlinkSqlParser";
|
||||||
@ -554,6 +556,19 @@ export interface FlinkSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitIdentityTransform?: (ctx: IdentityTransformContext) => void;
|
exitIdentityTransform?: (ctx: IdentityTransformContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by the `columnTransform`
|
||||||
|
* labeled alternative in `FlinkSqlParser.transform`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterColumnTransform?: (ctx: ColumnTransformContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by the `columnTransform`
|
||||||
|
* labeled alternative in `FlinkSqlParser.transform`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitColumnTransform?: (ctx: ColumnTransformContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by the `applyTransform`
|
* Enter a parse tree produced by the `applyTransform`
|
||||||
* labeled alternative in `FlinkSqlParser.transform`.
|
* labeled alternative in `FlinkSqlParser.transform`.
|
||||||
@ -918,6 +933,17 @@ export interface FlinkSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitPhysicalColumnDefinition?: (ctx: PhysicalColumnDefinitionContext) => void;
|
exitPhysicalColumnDefinition?: (ctx: PhysicalColumnDefinitionContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `FlinkSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterColumnNameCreate?: (ctx: ColumnNameCreateContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `FlinkSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitColumnNameCreate?: (ctx: ColumnNameCreateContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `FlinkSqlParser.columnName`.
|
* Enter a parse tree produced by `FlinkSqlParser.columnName`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Generated from /Users/liuyi/Desktop/Projects/dtstack/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
// Generated from /Users/hayden/Desktop/dt-works/dt-sql-parser/src/grammar/flinksql/FlinkSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
||||||
|
|
||||||
|
|
||||||
import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";
|
import { ParseTreeVisitor } from "antlr4ts/tree/ParseTreeVisitor";
|
||||||
@ -28,6 +28,7 @@ import { DateFunctionExpressionContext } from "./FlinkSqlParser";
|
|||||||
import { ErrorIdentContext } from "./FlinkSqlParser";
|
import { ErrorIdentContext } from "./FlinkSqlParser";
|
||||||
import { RealIdentContext } from "./FlinkSqlParser";
|
import { RealIdentContext } from "./FlinkSqlParser";
|
||||||
import { IdentityTransformContext } from "./FlinkSqlParser";
|
import { IdentityTransformContext } from "./FlinkSqlParser";
|
||||||
|
import { ColumnTransformContext } from "./FlinkSqlParser";
|
||||||
import { ApplyTransformContext } from "./FlinkSqlParser";
|
import { ApplyTransformContext } from "./FlinkSqlParser";
|
||||||
import { LogicalNotContext } from "./FlinkSqlParser";
|
import { LogicalNotContext } from "./FlinkSqlParser";
|
||||||
import { ExistsContext } from "./FlinkSqlParser";
|
import { ExistsContext } from "./FlinkSqlParser";
|
||||||
@ -60,6 +61,7 @@ import { SimpleCreateTableContext } from "./FlinkSqlParser";
|
|||||||
import { CreateTableAsSelectContext } from "./FlinkSqlParser";
|
import { CreateTableAsSelectContext } from "./FlinkSqlParser";
|
||||||
import { ColumnOptionDefinitionContext } from "./FlinkSqlParser";
|
import { ColumnOptionDefinitionContext } from "./FlinkSqlParser";
|
||||||
import { PhysicalColumnDefinitionContext } from "./FlinkSqlParser";
|
import { PhysicalColumnDefinitionContext } from "./FlinkSqlParser";
|
||||||
|
import { ColumnNameCreateContext } from "./FlinkSqlParser";
|
||||||
import { ColumnNameContext } from "./FlinkSqlParser";
|
import { ColumnNameContext } from "./FlinkSqlParser";
|
||||||
import { ColumnNameListContext } from "./FlinkSqlParser";
|
import { ColumnNameListContext } from "./FlinkSqlParser";
|
||||||
import { ColumnTypeContext } from "./FlinkSqlParser";
|
import { ColumnTypeContext } from "./FlinkSqlParser";
|
||||||
@ -432,6 +434,14 @@ export interface FlinkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
|
|||||||
*/
|
*/
|
||||||
visitIdentityTransform?: (ctx: IdentityTransformContext) => Result;
|
visitIdentityTransform?: (ctx: IdentityTransformContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by the `columnTransform`
|
||||||
|
* labeled alternative in `FlinkSqlParser.transform`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitColumnTransform?: (ctx: ColumnTransformContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by the `applyTransform`
|
* Visit a parse tree produced by the `applyTransform`
|
||||||
* labeled alternative in `FlinkSqlParser.transform`.
|
* labeled alternative in `FlinkSqlParser.transform`.
|
||||||
@ -662,6 +672,13 @@ export interface FlinkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
|
|||||||
*/
|
*/
|
||||||
visitPhysicalColumnDefinition?: (ctx: PhysicalColumnDefinitionContext) => Result;
|
visitPhysicalColumnDefinition?: (ctx: PhysicalColumnDefinitionContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `FlinkSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitColumnNameCreate?: (ctx: ColumnNameCreateContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `FlinkSqlParser.columnName`.
|
* Visit a parse tree produced by `FlinkSqlParser.columnName`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -145,6 +145,7 @@ import { ColumnNameTypeOrConstraintListContext } from "./HiveSqlParser";
|
|||||||
import { ColumnNameColonTypeListContext } from "./HiveSqlParser";
|
import { ColumnNameColonTypeListContext } from "./HiveSqlParser";
|
||||||
import { ColumnNameListContext } from "./HiveSqlParser";
|
import { ColumnNameListContext } from "./HiveSqlParser";
|
||||||
import { ColumnNameContext } from "./HiveSqlParser";
|
import { ColumnNameContext } from "./HiveSqlParser";
|
||||||
|
import { ColumnNameCreateContext } from "./HiveSqlParser";
|
||||||
import { ExtColumnNameContext } from "./HiveSqlParser";
|
import { ExtColumnNameContext } from "./HiveSqlParser";
|
||||||
import { ColumnNameOrderListContext } from "./HiveSqlParser";
|
import { ColumnNameOrderListContext } from "./HiveSqlParser";
|
||||||
import { ColumnParenthesesListContext } from "./HiveSqlParser";
|
import { ColumnParenthesesListContext } from "./HiveSqlParser";
|
||||||
@ -309,7 +310,6 @@ import { DataConnectorTypeContext } from "./HiveSqlParser";
|
|||||||
import { DcPropertiesContext } from "./HiveSqlParser";
|
import { DcPropertiesContext } from "./HiveSqlParser";
|
||||||
import { DropDataConnectorStatementContext } from "./HiveSqlParser";
|
import { DropDataConnectorStatementContext } from "./HiveSqlParser";
|
||||||
import { TableAllColumnsContext } from "./HiveSqlParser";
|
import { TableAllColumnsContext } from "./HiveSqlParser";
|
||||||
import { TableOrColumnContext } from "./HiveSqlParser";
|
|
||||||
import { DefaultValueContext } from "./HiveSqlParser";
|
import { DefaultValueContext } from "./HiveSqlParser";
|
||||||
import { ExpressionListContext } from "./HiveSqlParser";
|
import { ExpressionListContext } from "./HiveSqlParser";
|
||||||
import { AliasListContext } from "./HiveSqlParser";
|
import { AliasListContext } from "./HiveSqlParser";
|
||||||
@ -2093,6 +2093,17 @@ export interface HiveSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitColumnName?: (ctx: ColumnNameContext) => void;
|
exitColumnName?: (ctx: ColumnNameContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `HiveSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterColumnNameCreate?: (ctx: ColumnNameCreateContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `HiveSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitColumnNameCreate?: (ctx: ColumnNameCreateContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `HiveSqlParser.extColumnName`.
|
* Enter a parse tree produced by `HiveSqlParser.extColumnName`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -3897,17 +3908,6 @@ export interface HiveSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitTableAllColumns?: (ctx: TableAllColumnsContext) => void;
|
exitTableAllColumns?: (ctx: TableAllColumnsContext) => void;
|
||||||
|
|
||||||
/**
|
|
||||||
* Enter a parse tree produced by `HiveSqlParser.tableOrColumn`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
enterTableOrColumn?: (ctx: TableOrColumnContext) => void;
|
|
||||||
/**
|
|
||||||
* Exit a parse tree produced by `HiveSqlParser.tableOrColumn`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
*/
|
|
||||||
exitTableOrColumn?: (ctx: TableOrColumnContext) => void;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `HiveSqlParser.defaultValue`.
|
* Enter a parse tree produced by `HiveSqlParser.defaultValue`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
@ -145,6 +145,7 @@ import { ColumnNameTypeOrConstraintListContext } from "./HiveSqlParser";
|
|||||||
import { ColumnNameColonTypeListContext } from "./HiveSqlParser";
|
import { ColumnNameColonTypeListContext } from "./HiveSqlParser";
|
||||||
import { ColumnNameListContext } from "./HiveSqlParser";
|
import { ColumnNameListContext } from "./HiveSqlParser";
|
||||||
import { ColumnNameContext } from "./HiveSqlParser";
|
import { ColumnNameContext } from "./HiveSqlParser";
|
||||||
|
import { ColumnNameCreateContext } from "./HiveSqlParser";
|
||||||
import { ExtColumnNameContext } from "./HiveSqlParser";
|
import { ExtColumnNameContext } from "./HiveSqlParser";
|
||||||
import { ColumnNameOrderListContext } from "./HiveSqlParser";
|
import { ColumnNameOrderListContext } from "./HiveSqlParser";
|
||||||
import { ColumnParenthesesListContext } from "./HiveSqlParser";
|
import { ColumnParenthesesListContext } from "./HiveSqlParser";
|
||||||
@ -309,7 +310,6 @@ import { DataConnectorTypeContext } from "./HiveSqlParser";
|
|||||||
import { DcPropertiesContext } from "./HiveSqlParser";
|
import { DcPropertiesContext } from "./HiveSqlParser";
|
||||||
import { DropDataConnectorStatementContext } from "./HiveSqlParser";
|
import { DropDataConnectorStatementContext } from "./HiveSqlParser";
|
||||||
import { TableAllColumnsContext } from "./HiveSqlParser";
|
import { TableAllColumnsContext } from "./HiveSqlParser";
|
||||||
import { TableOrColumnContext } from "./HiveSqlParser";
|
|
||||||
import { DefaultValueContext } from "./HiveSqlParser";
|
import { DefaultValueContext } from "./HiveSqlParser";
|
||||||
import { ExpressionListContext } from "./HiveSqlParser";
|
import { ExpressionListContext } from "./HiveSqlParser";
|
||||||
import { AliasListContext } from "./HiveSqlParser";
|
import { AliasListContext } from "./HiveSqlParser";
|
||||||
@ -1528,6 +1528,13 @@ export interface HiveSqlParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|||||||
*/
|
*/
|
||||||
visitColumnName?: (ctx: ColumnNameContext) => Result;
|
visitColumnName?: (ctx: ColumnNameContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `HiveSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitColumnNameCreate?: (ctx: ColumnNameCreateContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `HiveSqlParser.extColumnName`.
|
* Visit a parse tree produced by `HiveSqlParser.extColumnName`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -2676,13 +2683,6 @@ export interface HiveSqlParserVisitor<Result> extends ParseTreeVisitor<Result> {
|
|||||||
*/
|
*/
|
||||||
visitTableAllColumns?: (ctx: TableAllColumnsContext) => Result;
|
visitTableAllColumns?: (ctx: TableAllColumnsContext) => Result;
|
||||||
|
|
||||||
/**
|
|
||||||
* Visit a parse tree produced by `HiveSqlParser.tableOrColumn`.
|
|
||||||
* @param ctx the parse tree
|
|
||||||
* @return the visitor result
|
|
||||||
*/
|
|
||||||
visitTableOrColumn?: (ctx: TableOrColumnContext) => Result;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `HiveSqlParser.defaultValue`.
|
* Visit a parse tree produced by `HiveSqlParser.defaultValue`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
File diff suppressed because one or more lines are too long
@ -189,200 +189,201 @@ KW_NANOSECOND=188
|
|||||||
KW_NANOSECONDS=189
|
KW_NANOSECONDS=189
|
||||||
KW_NATURAL=190
|
KW_NATURAL=190
|
||||||
KW_NO=191
|
KW_NO=191
|
||||||
KW_NOT=192
|
KW_NOSCAN=192
|
||||||
KW_NULL=193
|
KW_NOT=193
|
||||||
KW_NULLS=194
|
KW_NULL=194
|
||||||
KW_NUMERIC=195
|
KW_NULLS=195
|
||||||
KW_OF=196
|
KW_NUMERIC=196
|
||||||
KW_OFFSET=197
|
KW_OF=197
|
||||||
KW_ON=198
|
KW_OFFSET=198
|
||||||
KW_ONLY=199
|
KW_ON=199
|
||||||
KW_OPTION=200
|
KW_ONLY=200
|
||||||
KW_OPTIONS=201
|
KW_OPTION=201
|
||||||
KW_OR=202
|
KW_OPTIONS=202
|
||||||
KW_ORDER=203
|
KW_OR=203
|
||||||
KW_OUT=204
|
KW_ORDER=204
|
||||||
KW_OUTER=205
|
KW_OUT=205
|
||||||
KW_OUTPUTFORMAT=206
|
KW_OUTER=206
|
||||||
KW_OVER=207
|
KW_OUTPUTFORMAT=207
|
||||||
KW_OVERLAPS=208
|
KW_OVER=208
|
||||||
KW_OVERLAY=209
|
KW_OVERLAPS=209
|
||||||
KW_OVERWRITE=210
|
KW_OVERLAY=210
|
||||||
KW_PARTITION=211
|
KW_OVERWRITE=211
|
||||||
KW_PARTITIONED=212
|
KW_PARTITION=212
|
||||||
KW_PARTITIONS=213
|
KW_PARTITIONED=213
|
||||||
KW_PERCENTILE_CONT=214
|
KW_PARTITIONS=214
|
||||||
KW_PERCENTILE_DISC=215
|
KW_PERCENTILE_CONT=215
|
||||||
KW_PERCENTLIT=216
|
KW_PERCENTILE_DISC=216
|
||||||
KW_PIVOT=217
|
KW_PERCENTLIT=217
|
||||||
KW_PLACING=218
|
KW_PIVOT=218
|
||||||
KW_POSITION=219
|
KW_PLACING=219
|
||||||
KW_PRECEDING=220
|
KW_POSITION=220
|
||||||
KW_PRIMARY=221
|
KW_PRECEDING=221
|
||||||
KW_PRINCIPALS=222
|
KW_PRIMARY=222
|
||||||
KW_PROPERTIES=223
|
KW_PRINCIPALS=223
|
||||||
KW_PURGE=224
|
KW_PROPERTIES=224
|
||||||
KW_QUARTER=225
|
KW_PURGE=225
|
||||||
KW_QUERY=226
|
KW_QUARTER=226
|
||||||
KW_RANGE=227
|
KW_QUERY=227
|
||||||
KW_REAL=228
|
KW_RANGE=228
|
||||||
KW_RECORDREADER=229
|
KW_REAL=229
|
||||||
KW_RECORDWRITER=230
|
KW_RECORDREADER=230
|
||||||
KW_RECOVER=231
|
KW_RECORDWRITER=231
|
||||||
KW_REDUCE=232
|
KW_RECOVER=232
|
||||||
KW_REFERENCES=233
|
KW_REDUCE=233
|
||||||
KW_REFRESH=234
|
KW_REFERENCES=234
|
||||||
KW_RENAME=235
|
KW_REFRESH=235
|
||||||
KW_REPAIR=236
|
KW_RENAME=236
|
||||||
KW_REPEATABLE=237
|
KW_REPAIR=237
|
||||||
KW_REPLACE=238
|
KW_REPEATABLE=238
|
||||||
KW_RESET=239
|
KW_REPLACE=239
|
||||||
KW_RESPECT=240
|
KW_RESET=240
|
||||||
KW_RESTRICT=241
|
KW_RESPECT=241
|
||||||
KW_REVOKE=242
|
KW_RESTRICT=242
|
||||||
KW_RIGHT=243
|
KW_REVOKE=243
|
||||||
KW_RLIKE=244
|
KW_RIGHT=244
|
||||||
KW_REGEXP=245
|
KW_RLIKE=245
|
||||||
KW_ROLE=246
|
KW_REGEXP=246
|
||||||
KW_ROLES=247
|
KW_ROLE=247
|
||||||
KW_ROLLBACK=248
|
KW_ROLES=248
|
||||||
KW_ROLLUP=249
|
KW_ROLLBACK=249
|
||||||
KW_ROW=250
|
KW_ROLLUP=250
|
||||||
KW_ROWS=251
|
KW_ROW=251
|
||||||
KW_SECOND=252
|
KW_ROWS=252
|
||||||
KW_SECONDS=253
|
KW_SECOND=253
|
||||||
KW_SCHEMA=254
|
KW_SECONDS=254
|
||||||
KW_SCHEMAS=255
|
KW_SCHEMA=255
|
||||||
KW_SELECT=256
|
KW_SCHEMAS=256
|
||||||
KW_SEMI=257
|
KW_SELECT=257
|
||||||
KW_SEPARATED=258
|
KW_SEMI=258
|
||||||
KW_SERDE=259
|
KW_SEPARATED=259
|
||||||
KW_SERDEPROPERTIES=260
|
KW_SERDE=260
|
||||||
KW_SESSION_USER=261
|
KW_SERDEPROPERTIES=261
|
||||||
KW_SET=262
|
KW_SESSION_USER=262
|
||||||
KW_MINUS=263
|
KW_SET=263
|
||||||
KW_SETS=264
|
KW_MINUS=264
|
||||||
KW_SHORT=265
|
KW_SETS=265
|
||||||
KW_SHOW=266
|
KW_SHORT=266
|
||||||
KW_SINGLE=267
|
KW_SHOW=267
|
||||||
KW_SKEWED=268
|
KW_SINGLE=268
|
||||||
KW_SMALLINT=269
|
KW_SKEWED=269
|
||||||
KW_SOME=270
|
KW_SMALLINT=270
|
||||||
KW_SORT=271
|
KW_SOME=271
|
||||||
KW_SORTED=272
|
KW_SORT=272
|
||||||
KW_SOURCE=273
|
KW_SORTED=273
|
||||||
KW_START=274
|
KW_SOURCE=274
|
||||||
KW_STATISTICS=275
|
KW_START=275
|
||||||
KW_STORED=276
|
KW_STATISTICS=276
|
||||||
KW_STRATIFY=277
|
KW_STORED=277
|
||||||
KW_STRING=278
|
KW_STRATIFY=278
|
||||||
KW_STRUCT=279
|
KW_STRING=279
|
||||||
KW_SUBSTR=280
|
KW_STRUCT=280
|
||||||
KW_SUBSTRING=281
|
KW_SUBSTR=281
|
||||||
KW_SYNC=282
|
KW_SUBSTRING=282
|
||||||
KW_SYSTEM=283
|
KW_SYNC=283
|
||||||
KW_SYSTEM_TIME=284
|
KW_SYSTEM=284
|
||||||
KW_SYSTEM_VERSION=285
|
KW_SYSTEM_TIME=285
|
||||||
KW_TABLE=286
|
KW_SYSTEM_VERSION=286
|
||||||
KW_TABLES=287
|
KW_TABLE=287
|
||||||
KW_TABLESAMPLE=288
|
KW_TABLES=288
|
||||||
KW_TARGET=289
|
KW_TABLESAMPLE=289
|
||||||
KW_TBLPROPERTIES=290
|
KW_TARGET=290
|
||||||
KW_TEMPORARY=291
|
KW_TBLPROPERTIES=291
|
||||||
KW_TERMINATED=292
|
KW_TEMPORARY=292
|
||||||
KW_THEN=293
|
KW_TERMINATED=293
|
||||||
KW_TIME=294
|
KW_THEN=294
|
||||||
KW_TIMEDIFF=295
|
KW_TIME=295
|
||||||
KW_TIMESTAMP=296
|
KW_TIMEDIFF=296
|
||||||
KW_TIMESTAMP_LTZ=297
|
KW_TIMESTAMP=297
|
||||||
KW_TIMESTAMP_NTZ=298
|
KW_TIMESTAMP_LTZ=298
|
||||||
KW_TIMESTAMPADD=299
|
KW_TIMESTAMP_NTZ=299
|
||||||
KW_TIMESTAMPDIFF=300
|
KW_TIMESTAMPADD=300
|
||||||
KW_TINYINT=301
|
KW_TIMESTAMPDIFF=301
|
||||||
KW_TO=302
|
KW_TINYINT=302
|
||||||
KW_TOUCH=303
|
KW_TO=303
|
||||||
KW_TRAILING=304
|
KW_TOUCH=304
|
||||||
KW_TRANSACTION=305
|
KW_TRAILING=305
|
||||||
KW_TRANSACTIONS=306
|
KW_TRANSACTION=306
|
||||||
KW_TRANSFORM=307
|
KW_TRANSACTIONS=307
|
||||||
KW_TRIM=308
|
KW_TRANSFORM=308
|
||||||
KW_TRUE=309
|
KW_TRIM=309
|
||||||
KW_TRUNCATE=310
|
KW_TRUE=310
|
||||||
KW_TRY_CAST=311
|
KW_TRUNCATE=311
|
||||||
KW_TYPE=312
|
KW_TRY_CAST=312
|
||||||
KW_UNARCHIVE=313
|
KW_TYPE=313
|
||||||
KW_UNBOUNDED=314
|
KW_UNARCHIVE=314
|
||||||
KW_UNCACHE=315
|
KW_UNBOUNDED=315
|
||||||
KW_UNION=316
|
KW_UNCACHE=316
|
||||||
KW_UNIQUE=317
|
KW_UNION=317
|
||||||
KW_UNKNOWN=318
|
KW_UNIQUE=318
|
||||||
KW_UNLOCK=319
|
KW_UNKNOWN=319
|
||||||
KW_UNPIVOT=320
|
KW_UNLOCK=320
|
||||||
KW_UNSET=321
|
KW_UNPIVOT=321
|
||||||
KW_UPDATE=322
|
KW_UNSET=322
|
||||||
KW_USE=323
|
KW_UPDATE=323
|
||||||
KW_USER=324
|
KW_USE=324
|
||||||
KW_USING=325
|
KW_USER=325
|
||||||
KW_VALUES=326
|
KW_USING=326
|
||||||
KW_VARCHAR=327
|
KW_VALUES=327
|
||||||
KW_VAR=328
|
KW_VARCHAR=328
|
||||||
KW_VARIABLE=329
|
KW_VAR=329
|
||||||
KW_VERSION=330
|
KW_VARIABLE=330
|
||||||
KW_VIEW=331
|
KW_VERSION=331
|
||||||
KW_VIEWS=332
|
KW_VIEW=332
|
||||||
KW_VOID=333
|
KW_VIEWS=333
|
||||||
KW_WEEK=334
|
KW_VOID=334
|
||||||
KW_WEEKS=335
|
KW_WEEK=335
|
||||||
KW_WHEN=336
|
KW_WEEKS=336
|
||||||
KW_WHERE=337
|
KW_WHEN=337
|
||||||
KW_WINDOW=338
|
KW_WHERE=338
|
||||||
KW_WITH=339
|
KW_WINDOW=339
|
||||||
KW_WITHIN=340
|
KW_WITH=340
|
||||||
KW_YEAR=341
|
KW_WITHIN=341
|
||||||
KW_YEARS=342
|
KW_YEAR=342
|
||||||
KW_ZONE=343
|
KW_YEARS=343
|
||||||
EQ=344
|
KW_ZONE=344
|
||||||
NSEQ=345
|
EQ=345
|
||||||
NEQ=346
|
NSEQ=346
|
||||||
NEQJ=347
|
NEQ=347
|
||||||
LT=348
|
NEQJ=348
|
||||||
LTE=349
|
LT=349
|
||||||
GT=350
|
LTE=350
|
||||||
GTE=351
|
GT=351
|
||||||
NOT=352
|
GTE=352
|
||||||
PLUS=353
|
NOT=353
|
||||||
MINUS=354
|
PLUS=354
|
||||||
ASTERISK=355
|
MINUS=355
|
||||||
SLASH=356
|
ASTERISK=356
|
||||||
PERCENT=357
|
SLASH=357
|
||||||
TILDE=358
|
PERCENT=358
|
||||||
AMPERSAND=359
|
TILDE=359
|
||||||
PIPE=360
|
AMPERSAND=360
|
||||||
CONCAT_PIPE=361
|
PIPE=361
|
||||||
HAT=362
|
CONCAT_PIPE=362
|
||||||
COLON=363
|
HAT=363
|
||||||
ARROW=364
|
COLON=364
|
||||||
FAT_ARROW=365
|
ARROW=365
|
||||||
HENT_START=366
|
FAT_ARROW=366
|
||||||
HENT_END=367
|
HENT_START=367
|
||||||
QUESTION=368
|
HENT_END=368
|
||||||
STRING_LITERAL=369
|
QUESTION=369
|
||||||
DOUBLEQUOTED_STRING=370
|
STRING_LITERAL=370
|
||||||
BIGINT_LITERAL=371
|
DOUBLEQUOTED_STRING=371
|
||||||
SMALLINT_LITERAL=372
|
BIGINT_LITERAL=372
|
||||||
TINYINT_LITERAL=373
|
SMALLINT_LITERAL=373
|
||||||
INTEGER_VALUE=374
|
TINYINT_LITERAL=374
|
||||||
EXPONENT_VALUE=375
|
INTEGER_VALUE=375
|
||||||
DECIMAL_VALUE=376
|
EXPONENT_VALUE=376
|
||||||
FLOAT_LITERAL=377
|
DECIMAL_VALUE=377
|
||||||
DOUBLE_LITERAL=378
|
FLOAT_LITERAL=378
|
||||||
BIGDECIMAL_LITERAL=379
|
DOUBLE_LITERAL=379
|
||||||
IDENTIFIER=380
|
BIGDECIMAL_LITERAL=380
|
||||||
BACKQUOTED_IDENTIFIER=381
|
IDENTIFIER=381
|
||||||
SIMPLE_COMMENT=382
|
BACKQUOTED_IDENTIFIER=382
|
||||||
BRACKETED_COMMENT=383
|
SIMPLE_COMMENT=383
|
||||||
WS=384
|
BRACKETED_COMMENT=384
|
||||||
UNRECOGNIZED=385
|
WS=385
|
||||||
|
UNRECOGNIZED=386
|
||||||
';'=1
|
';'=1
|
||||||
'('=2
|
'('=2
|
||||||
')'=3
|
')'=3
|
||||||
@ -574,177 +575,178 @@ UNRECOGNIZED=385
|
|||||||
'NANOSECONDS'=189
|
'NANOSECONDS'=189
|
||||||
'NATURAL'=190
|
'NATURAL'=190
|
||||||
'NO'=191
|
'NO'=191
|
||||||
'NOT'=192
|
'NOSCAN'=192
|
||||||
'NULL'=193
|
'NOT'=193
|
||||||
'NULLS'=194
|
'NULL'=194
|
||||||
'NUMERIC'=195
|
'NULLS'=195
|
||||||
'OF'=196
|
'NUMERIC'=196
|
||||||
'OFFSET'=197
|
'OF'=197
|
||||||
'ON'=198
|
'OFFSET'=198
|
||||||
'ONLY'=199
|
'ON'=199
|
||||||
'OPTION'=200
|
'ONLY'=200
|
||||||
'OPTIONS'=201
|
'OPTION'=201
|
||||||
'OR'=202
|
'OPTIONS'=202
|
||||||
'ORDER'=203
|
'OR'=203
|
||||||
'OUT'=204
|
'ORDER'=204
|
||||||
'OUTER'=205
|
'OUT'=205
|
||||||
'OUTPUTFORMAT'=206
|
'OUTER'=206
|
||||||
'OVER'=207
|
'OUTPUTFORMAT'=207
|
||||||
'OVERLAPS'=208
|
'OVER'=208
|
||||||
'OVERLAY'=209
|
'OVERLAPS'=209
|
||||||
'OVERWRITE'=210
|
'OVERLAY'=210
|
||||||
'PARTITION'=211
|
'OVERWRITE'=211
|
||||||
'PARTITIONED'=212
|
'PARTITION'=212
|
||||||
'PARTITIONS'=213
|
'PARTITIONED'=213
|
||||||
'PERCENTILE_CONT'=214
|
'PARTITIONS'=214
|
||||||
'PERCENTILE_DISC'=215
|
'PERCENTILE_CONT'=215
|
||||||
'PERCENT'=216
|
'PERCENTILE_DISC'=216
|
||||||
'PIVOT'=217
|
'PERCENT'=217
|
||||||
'PLACING'=218
|
'PIVOT'=218
|
||||||
'POSITION'=219
|
'PLACING'=219
|
||||||
'PRECEDING'=220
|
'POSITION'=220
|
||||||
'PRIMARY'=221
|
'PRECEDING'=221
|
||||||
'PRINCIPALS'=222
|
'PRIMARY'=222
|
||||||
'PROPERTIES'=223
|
'PRINCIPALS'=223
|
||||||
'PURGE'=224
|
'PROPERTIES'=224
|
||||||
'QUARTER'=225
|
'PURGE'=225
|
||||||
'QUERY'=226
|
'QUARTER'=226
|
||||||
'RANGE'=227
|
'QUERY'=227
|
||||||
'REAL'=228
|
'RANGE'=228
|
||||||
'RECORDREADER'=229
|
'REAL'=229
|
||||||
'RECORDWRITER'=230
|
'RECORDREADER'=230
|
||||||
'RECOVER'=231
|
'RECORDWRITER'=231
|
||||||
'REDUCE'=232
|
'RECOVER'=232
|
||||||
'REFERENCES'=233
|
'REDUCE'=233
|
||||||
'REFRESH'=234
|
'REFERENCES'=234
|
||||||
'RENAME'=235
|
'REFRESH'=235
|
||||||
'REPAIR'=236
|
'RENAME'=236
|
||||||
'REPEATABLE'=237
|
'REPAIR'=237
|
||||||
'REPLACE'=238
|
'REPEATABLE'=238
|
||||||
'RESET'=239
|
'REPLACE'=239
|
||||||
'RESPECT'=240
|
'RESET'=240
|
||||||
'RESTRICT'=241
|
'RESPECT'=241
|
||||||
'REVOKE'=242
|
'RESTRICT'=242
|
||||||
'RIGHT'=243
|
'REVOKE'=243
|
||||||
'RLIKE'=244
|
'RIGHT'=244
|
||||||
'REGEXP'=245
|
'RLIKE'=245
|
||||||
'ROLE'=246
|
'REGEXP'=246
|
||||||
'ROLES'=247
|
'ROLE'=247
|
||||||
'ROLLBACK'=248
|
'ROLES'=248
|
||||||
'ROLLUP'=249
|
'ROLLBACK'=249
|
||||||
'ROW'=250
|
'ROLLUP'=250
|
||||||
'ROWS'=251
|
'ROW'=251
|
||||||
'SECOND'=252
|
'ROWS'=252
|
||||||
'SECONDS'=253
|
'SECOND'=253
|
||||||
'SCHEMA'=254
|
'SECONDS'=254
|
||||||
'SCHEMAS'=255
|
'SCHEMA'=255
|
||||||
'SELECT'=256
|
'SCHEMAS'=256
|
||||||
'SEMI'=257
|
'SELECT'=257
|
||||||
'SEPARATED'=258
|
'SEMI'=258
|
||||||
'SERDE'=259
|
'SEPARATED'=259
|
||||||
'SERDEPROPERTIES'=260
|
'SERDE'=260
|
||||||
'SESSION_USER'=261
|
'SERDEPROPERTIES'=261
|
||||||
'SET'=262
|
'SESSION_USER'=262
|
||||||
'MINUS'=263
|
'SET'=263
|
||||||
'SETS'=264
|
'MINUS'=264
|
||||||
'SHORT'=265
|
'SETS'=265
|
||||||
'SHOW'=266
|
'SHORT'=266
|
||||||
'SINGLE'=267
|
'SHOW'=267
|
||||||
'SKEWED'=268
|
'SINGLE'=268
|
||||||
'SMALLINT'=269
|
'SKEWED'=269
|
||||||
'SOME'=270
|
'SMALLINT'=270
|
||||||
'SORT'=271
|
'SOME'=271
|
||||||
'SORTED'=272
|
'SORT'=272
|
||||||
'SOURCE'=273
|
'SORTED'=273
|
||||||
'START'=274
|
'SOURCE'=274
|
||||||
'STATISTICS'=275
|
'START'=275
|
||||||
'STORED'=276
|
'STATISTICS'=276
|
||||||
'STRATIFY'=277
|
'STORED'=277
|
||||||
'STRING'=278
|
'STRATIFY'=278
|
||||||
'STRUCT'=279
|
'STRING'=279
|
||||||
'SUBSTR'=280
|
'STRUCT'=280
|
||||||
'SUBSTRING'=281
|
'SUBSTR'=281
|
||||||
'SYNC'=282
|
'SUBSTRING'=282
|
||||||
'SYSTEM'=283
|
'SYNC'=283
|
||||||
'SYSTEM_TIME'=284
|
'SYSTEM'=284
|
||||||
'SYSTEM_VERSION'=285
|
'SYSTEM_TIME'=285
|
||||||
'TABLE'=286
|
'SYSTEM_VERSION'=286
|
||||||
'TABLES'=287
|
'TABLE'=287
|
||||||
'TABLESAMPLE'=288
|
'TABLES'=288
|
||||||
'TARGET'=289
|
'TABLESAMPLE'=289
|
||||||
'TBLPROPERTIES'=290
|
'TARGET'=290
|
||||||
'TEMPORARY'=291
|
'TBLPROPERTIES'=291
|
||||||
'TERMINATED'=292
|
'TEMPORARY'=292
|
||||||
'THEN'=293
|
'TERMINATED'=293
|
||||||
'TIME'=294
|
'THEN'=294
|
||||||
'TIMEDIFF'=295
|
'TIME'=295
|
||||||
'TIMESTAMP'=296
|
'TIMEDIFF'=296
|
||||||
'TIMESTAMP_LTZ'=297
|
'TIMESTAMP'=297
|
||||||
'TIMESTAMP_NTZ'=298
|
'TIMESTAMP_LTZ'=298
|
||||||
'TIMESTAMPADD'=299
|
'TIMESTAMP_NTZ'=299
|
||||||
'TIMESTAMPDIFF'=300
|
'TIMESTAMPADD'=300
|
||||||
'TINYINT'=301
|
'TIMESTAMPDIFF'=301
|
||||||
'TO'=302
|
'TINYINT'=302
|
||||||
'TOUCH'=303
|
'TO'=303
|
||||||
'TRAILING'=304
|
'TOUCH'=304
|
||||||
'TRANSACTION'=305
|
'TRAILING'=305
|
||||||
'TRANSACTIONS'=306
|
'TRANSACTION'=306
|
||||||
'TRANSFORM'=307
|
'TRANSACTIONS'=307
|
||||||
'TRIM'=308
|
'TRANSFORM'=308
|
||||||
'TRUE'=309
|
'TRIM'=309
|
||||||
'TRUNCATE'=310
|
'TRUE'=310
|
||||||
'TRY_CAST'=311
|
'TRUNCATE'=311
|
||||||
'TYPE'=312
|
'TRY_CAST'=312
|
||||||
'UNARCHIVE'=313
|
'TYPE'=313
|
||||||
'UNBOUNDED'=314
|
'UNARCHIVE'=314
|
||||||
'UNCACHE'=315
|
'UNBOUNDED'=315
|
||||||
'UNION'=316
|
'UNCACHE'=316
|
||||||
'UNIQUE'=317
|
'UNION'=317
|
||||||
'UNKNOWN'=318
|
'UNIQUE'=318
|
||||||
'UNLOCK'=319
|
'UNKNOWN'=319
|
||||||
'UNPIVOT'=320
|
'UNLOCK'=320
|
||||||
'UNSET'=321
|
'UNPIVOT'=321
|
||||||
'UPDATE'=322
|
'UNSET'=322
|
||||||
'USE'=323
|
'UPDATE'=323
|
||||||
'USER'=324
|
'USE'=324
|
||||||
'USING'=325
|
'USER'=325
|
||||||
'VALUES'=326
|
'USING'=326
|
||||||
'VARCHAR'=327
|
'VALUES'=327
|
||||||
'VAR'=328
|
'VARCHAR'=328
|
||||||
'VARIABLE'=329
|
'VAR'=329
|
||||||
'VERSION'=330
|
'VARIABLE'=330
|
||||||
'VIEW'=331
|
'VERSION'=331
|
||||||
'VIEWS'=332
|
'VIEW'=332
|
||||||
'VOID'=333
|
'VIEWS'=333
|
||||||
'WEEK'=334
|
'VOID'=334
|
||||||
'WEEKS'=335
|
'WEEK'=335
|
||||||
'WHEN'=336
|
'WEEKS'=336
|
||||||
'WHERE'=337
|
'WHEN'=337
|
||||||
'WINDOW'=338
|
'WHERE'=338
|
||||||
'WITH'=339
|
'WINDOW'=339
|
||||||
'WITHIN'=340
|
'WITH'=340
|
||||||
'YEAR'=341
|
'WITHIN'=341
|
||||||
'YEARS'=342
|
'YEAR'=342
|
||||||
'ZONE'=343
|
'YEARS'=343
|
||||||
'<=>'=345
|
'ZONE'=344
|
||||||
'<>'=346
|
'<=>'=346
|
||||||
'!='=347
|
'<>'=347
|
||||||
'<'=348
|
'!='=348
|
||||||
'>'=350
|
'<'=349
|
||||||
'!'=352
|
'>'=351
|
||||||
'+'=353
|
'!'=353
|
||||||
'-'=354
|
'+'=354
|
||||||
'*'=355
|
'-'=355
|
||||||
'/'=356
|
'*'=356
|
||||||
'%'=357
|
'/'=357
|
||||||
'~'=358
|
'%'=358
|
||||||
'&'=359
|
'~'=359
|
||||||
'|'=360
|
'&'=360
|
||||||
'||'=361
|
'|'=361
|
||||||
'^'=362
|
'||'=362
|
||||||
':'=363
|
'^'=363
|
||||||
'->'=364
|
':'=364
|
||||||
'=>'=365
|
'->'=365
|
||||||
'/*+'=366
|
'=>'=366
|
||||||
'*/'=367
|
'/*+'=367
|
||||||
'?'=368
|
'*/'=368
|
||||||
|
'?'=369
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@ -189,200 +189,201 @@ KW_NANOSECOND=188
|
|||||||
KW_NANOSECONDS=189
|
KW_NANOSECONDS=189
|
||||||
KW_NATURAL=190
|
KW_NATURAL=190
|
||||||
KW_NO=191
|
KW_NO=191
|
||||||
KW_NOT=192
|
KW_NOSCAN=192
|
||||||
KW_NULL=193
|
KW_NOT=193
|
||||||
KW_NULLS=194
|
KW_NULL=194
|
||||||
KW_NUMERIC=195
|
KW_NULLS=195
|
||||||
KW_OF=196
|
KW_NUMERIC=196
|
||||||
KW_OFFSET=197
|
KW_OF=197
|
||||||
KW_ON=198
|
KW_OFFSET=198
|
||||||
KW_ONLY=199
|
KW_ON=199
|
||||||
KW_OPTION=200
|
KW_ONLY=200
|
||||||
KW_OPTIONS=201
|
KW_OPTION=201
|
||||||
KW_OR=202
|
KW_OPTIONS=202
|
||||||
KW_ORDER=203
|
KW_OR=203
|
||||||
KW_OUT=204
|
KW_ORDER=204
|
||||||
KW_OUTER=205
|
KW_OUT=205
|
||||||
KW_OUTPUTFORMAT=206
|
KW_OUTER=206
|
||||||
KW_OVER=207
|
KW_OUTPUTFORMAT=207
|
||||||
KW_OVERLAPS=208
|
KW_OVER=208
|
||||||
KW_OVERLAY=209
|
KW_OVERLAPS=209
|
||||||
KW_OVERWRITE=210
|
KW_OVERLAY=210
|
||||||
KW_PARTITION=211
|
KW_OVERWRITE=211
|
||||||
KW_PARTITIONED=212
|
KW_PARTITION=212
|
||||||
KW_PARTITIONS=213
|
KW_PARTITIONED=213
|
||||||
KW_PERCENTILE_CONT=214
|
KW_PARTITIONS=214
|
||||||
KW_PERCENTILE_DISC=215
|
KW_PERCENTILE_CONT=215
|
||||||
KW_PERCENTLIT=216
|
KW_PERCENTILE_DISC=216
|
||||||
KW_PIVOT=217
|
KW_PERCENTLIT=217
|
||||||
KW_PLACING=218
|
KW_PIVOT=218
|
||||||
KW_POSITION=219
|
KW_PLACING=219
|
||||||
KW_PRECEDING=220
|
KW_POSITION=220
|
||||||
KW_PRIMARY=221
|
KW_PRECEDING=221
|
||||||
KW_PRINCIPALS=222
|
KW_PRIMARY=222
|
||||||
KW_PROPERTIES=223
|
KW_PRINCIPALS=223
|
||||||
KW_PURGE=224
|
KW_PROPERTIES=224
|
||||||
KW_QUARTER=225
|
KW_PURGE=225
|
||||||
KW_QUERY=226
|
KW_QUARTER=226
|
||||||
KW_RANGE=227
|
KW_QUERY=227
|
||||||
KW_REAL=228
|
KW_RANGE=228
|
||||||
KW_RECORDREADER=229
|
KW_REAL=229
|
||||||
KW_RECORDWRITER=230
|
KW_RECORDREADER=230
|
||||||
KW_RECOVER=231
|
KW_RECORDWRITER=231
|
||||||
KW_REDUCE=232
|
KW_RECOVER=232
|
||||||
KW_REFERENCES=233
|
KW_REDUCE=233
|
||||||
KW_REFRESH=234
|
KW_REFERENCES=234
|
||||||
KW_RENAME=235
|
KW_REFRESH=235
|
||||||
KW_REPAIR=236
|
KW_RENAME=236
|
||||||
KW_REPEATABLE=237
|
KW_REPAIR=237
|
||||||
KW_REPLACE=238
|
KW_REPEATABLE=238
|
||||||
KW_RESET=239
|
KW_REPLACE=239
|
||||||
KW_RESPECT=240
|
KW_RESET=240
|
||||||
KW_RESTRICT=241
|
KW_RESPECT=241
|
||||||
KW_REVOKE=242
|
KW_RESTRICT=242
|
||||||
KW_RIGHT=243
|
KW_REVOKE=243
|
||||||
KW_RLIKE=244
|
KW_RIGHT=244
|
||||||
KW_REGEXP=245
|
KW_RLIKE=245
|
||||||
KW_ROLE=246
|
KW_REGEXP=246
|
||||||
KW_ROLES=247
|
KW_ROLE=247
|
||||||
KW_ROLLBACK=248
|
KW_ROLES=248
|
||||||
KW_ROLLUP=249
|
KW_ROLLBACK=249
|
||||||
KW_ROW=250
|
KW_ROLLUP=250
|
||||||
KW_ROWS=251
|
KW_ROW=251
|
||||||
KW_SECOND=252
|
KW_ROWS=252
|
||||||
KW_SECONDS=253
|
KW_SECOND=253
|
||||||
KW_SCHEMA=254
|
KW_SECONDS=254
|
||||||
KW_SCHEMAS=255
|
KW_SCHEMA=255
|
||||||
KW_SELECT=256
|
KW_SCHEMAS=256
|
||||||
KW_SEMI=257
|
KW_SELECT=257
|
||||||
KW_SEPARATED=258
|
KW_SEMI=258
|
||||||
KW_SERDE=259
|
KW_SEPARATED=259
|
||||||
KW_SERDEPROPERTIES=260
|
KW_SERDE=260
|
||||||
KW_SESSION_USER=261
|
KW_SERDEPROPERTIES=261
|
||||||
KW_SET=262
|
KW_SESSION_USER=262
|
||||||
KW_MINUS=263
|
KW_SET=263
|
||||||
KW_SETS=264
|
KW_MINUS=264
|
||||||
KW_SHORT=265
|
KW_SETS=265
|
||||||
KW_SHOW=266
|
KW_SHORT=266
|
||||||
KW_SINGLE=267
|
KW_SHOW=267
|
||||||
KW_SKEWED=268
|
KW_SINGLE=268
|
||||||
KW_SMALLINT=269
|
KW_SKEWED=269
|
||||||
KW_SOME=270
|
KW_SMALLINT=270
|
||||||
KW_SORT=271
|
KW_SOME=271
|
||||||
KW_SORTED=272
|
KW_SORT=272
|
||||||
KW_SOURCE=273
|
KW_SORTED=273
|
||||||
KW_START=274
|
KW_SOURCE=274
|
||||||
KW_STATISTICS=275
|
KW_START=275
|
||||||
KW_STORED=276
|
KW_STATISTICS=276
|
||||||
KW_STRATIFY=277
|
KW_STORED=277
|
||||||
KW_STRING=278
|
KW_STRATIFY=278
|
||||||
KW_STRUCT=279
|
KW_STRING=279
|
||||||
KW_SUBSTR=280
|
KW_STRUCT=280
|
||||||
KW_SUBSTRING=281
|
KW_SUBSTR=281
|
||||||
KW_SYNC=282
|
KW_SUBSTRING=282
|
||||||
KW_SYSTEM=283
|
KW_SYNC=283
|
||||||
KW_SYSTEM_TIME=284
|
KW_SYSTEM=284
|
||||||
KW_SYSTEM_VERSION=285
|
KW_SYSTEM_TIME=285
|
||||||
KW_TABLE=286
|
KW_SYSTEM_VERSION=286
|
||||||
KW_TABLES=287
|
KW_TABLE=287
|
||||||
KW_TABLESAMPLE=288
|
KW_TABLES=288
|
||||||
KW_TARGET=289
|
KW_TABLESAMPLE=289
|
||||||
KW_TBLPROPERTIES=290
|
KW_TARGET=290
|
||||||
KW_TEMPORARY=291
|
KW_TBLPROPERTIES=291
|
||||||
KW_TERMINATED=292
|
KW_TEMPORARY=292
|
||||||
KW_THEN=293
|
KW_TERMINATED=293
|
||||||
KW_TIME=294
|
KW_THEN=294
|
||||||
KW_TIMEDIFF=295
|
KW_TIME=295
|
||||||
KW_TIMESTAMP=296
|
KW_TIMEDIFF=296
|
||||||
KW_TIMESTAMP_LTZ=297
|
KW_TIMESTAMP=297
|
||||||
KW_TIMESTAMP_NTZ=298
|
KW_TIMESTAMP_LTZ=298
|
||||||
KW_TIMESTAMPADD=299
|
KW_TIMESTAMP_NTZ=299
|
||||||
KW_TIMESTAMPDIFF=300
|
KW_TIMESTAMPADD=300
|
||||||
KW_TINYINT=301
|
KW_TIMESTAMPDIFF=301
|
||||||
KW_TO=302
|
KW_TINYINT=302
|
||||||
KW_TOUCH=303
|
KW_TO=303
|
||||||
KW_TRAILING=304
|
KW_TOUCH=304
|
||||||
KW_TRANSACTION=305
|
KW_TRAILING=305
|
||||||
KW_TRANSACTIONS=306
|
KW_TRANSACTION=306
|
||||||
KW_TRANSFORM=307
|
KW_TRANSACTIONS=307
|
||||||
KW_TRIM=308
|
KW_TRANSFORM=308
|
||||||
KW_TRUE=309
|
KW_TRIM=309
|
||||||
KW_TRUNCATE=310
|
KW_TRUE=310
|
||||||
KW_TRY_CAST=311
|
KW_TRUNCATE=311
|
||||||
KW_TYPE=312
|
KW_TRY_CAST=312
|
||||||
KW_UNARCHIVE=313
|
KW_TYPE=313
|
||||||
KW_UNBOUNDED=314
|
KW_UNARCHIVE=314
|
||||||
KW_UNCACHE=315
|
KW_UNBOUNDED=315
|
||||||
KW_UNION=316
|
KW_UNCACHE=316
|
||||||
KW_UNIQUE=317
|
KW_UNION=317
|
||||||
KW_UNKNOWN=318
|
KW_UNIQUE=318
|
||||||
KW_UNLOCK=319
|
KW_UNKNOWN=319
|
||||||
KW_UNPIVOT=320
|
KW_UNLOCK=320
|
||||||
KW_UNSET=321
|
KW_UNPIVOT=321
|
||||||
KW_UPDATE=322
|
KW_UNSET=322
|
||||||
KW_USE=323
|
KW_UPDATE=323
|
||||||
KW_USER=324
|
KW_USE=324
|
||||||
KW_USING=325
|
KW_USER=325
|
||||||
KW_VALUES=326
|
KW_USING=326
|
||||||
KW_VARCHAR=327
|
KW_VALUES=327
|
||||||
KW_VAR=328
|
KW_VARCHAR=328
|
||||||
KW_VARIABLE=329
|
KW_VAR=329
|
||||||
KW_VERSION=330
|
KW_VARIABLE=330
|
||||||
KW_VIEW=331
|
KW_VERSION=331
|
||||||
KW_VIEWS=332
|
KW_VIEW=332
|
||||||
KW_VOID=333
|
KW_VIEWS=333
|
||||||
KW_WEEK=334
|
KW_VOID=334
|
||||||
KW_WEEKS=335
|
KW_WEEK=335
|
||||||
KW_WHEN=336
|
KW_WEEKS=336
|
||||||
KW_WHERE=337
|
KW_WHEN=337
|
||||||
KW_WINDOW=338
|
KW_WHERE=338
|
||||||
KW_WITH=339
|
KW_WINDOW=339
|
||||||
KW_WITHIN=340
|
KW_WITH=340
|
||||||
KW_YEAR=341
|
KW_WITHIN=341
|
||||||
KW_YEARS=342
|
KW_YEAR=342
|
||||||
KW_ZONE=343
|
KW_YEARS=343
|
||||||
EQ=344
|
KW_ZONE=344
|
||||||
NSEQ=345
|
EQ=345
|
||||||
NEQ=346
|
NSEQ=346
|
||||||
NEQJ=347
|
NEQ=347
|
||||||
LT=348
|
NEQJ=348
|
||||||
LTE=349
|
LT=349
|
||||||
GT=350
|
LTE=350
|
||||||
GTE=351
|
GT=351
|
||||||
NOT=352
|
GTE=352
|
||||||
PLUS=353
|
NOT=353
|
||||||
MINUS=354
|
PLUS=354
|
||||||
ASTERISK=355
|
MINUS=355
|
||||||
SLASH=356
|
ASTERISK=356
|
||||||
PERCENT=357
|
SLASH=357
|
||||||
TILDE=358
|
PERCENT=358
|
||||||
AMPERSAND=359
|
TILDE=359
|
||||||
PIPE=360
|
AMPERSAND=360
|
||||||
CONCAT_PIPE=361
|
PIPE=361
|
||||||
HAT=362
|
CONCAT_PIPE=362
|
||||||
COLON=363
|
HAT=363
|
||||||
ARROW=364
|
COLON=364
|
||||||
FAT_ARROW=365
|
ARROW=365
|
||||||
HENT_START=366
|
FAT_ARROW=366
|
||||||
HENT_END=367
|
HENT_START=367
|
||||||
QUESTION=368
|
HENT_END=368
|
||||||
STRING_LITERAL=369
|
QUESTION=369
|
||||||
DOUBLEQUOTED_STRING=370
|
STRING_LITERAL=370
|
||||||
BIGINT_LITERAL=371
|
DOUBLEQUOTED_STRING=371
|
||||||
SMALLINT_LITERAL=372
|
BIGINT_LITERAL=372
|
||||||
TINYINT_LITERAL=373
|
SMALLINT_LITERAL=373
|
||||||
INTEGER_VALUE=374
|
TINYINT_LITERAL=374
|
||||||
EXPONENT_VALUE=375
|
INTEGER_VALUE=375
|
||||||
DECIMAL_VALUE=376
|
EXPONENT_VALUE=376
|
||||||
FLOAT_LITERAL=377
|
DECIMAL_VALUE=377
|
||||||
DOUBLE_LITERAL=378
|
FLOAT_LITERAL=378
|
||||||
BIGDECIMAL_LITERAL=379
|
DOUBLE_LITERAL=379
|
||||||
IDENTIFIER=380
|
BIGDECIMAL_LITERAL=380
|
||||||
BACKQUOTED_IDENTIFIER=381
|
IDENTIFIER=381
|
||||||
SIMPLE_COMMENT=382
|
BACKQUOTED_IDENTIFIER=382
|
||||||
BRACKETED_COMMENT=383
|
SIMPLE_COMMENT=383
|
||||||
WS=384
|
BRACKETED_COMMENT=384
|
||||||
UNRECOGNIZED=385
|
WS=385
|
||||||
|
UNRECOGNIZED=386
|
||||||
';'=1
|
';'=1
|
||||||
'('=2
|
'('=2
|
||||||
')'=3
|
')'=3
|
||||||
@ -574,177 +575,178 @@ UNRECOGNIZED=385
|
|||||||
'NANOSECONDS'=189
|
'NANOSECONDS'=189
|
||||||
'NATURAL'=190
|
'NATURAL'=190
|
||||||
'NO'=191
|
'NO'=191
|
||||||
'NOT'=192
|
'NOSCAN'=192
|
||||||
'NULL'=193
|
'NOT'=193
|
||||||
'NULLS'=194
|
'NULL'=194
|
||||||
'NUMERIC'=195
|
'NULLS'=195
|
||||||
'OF'=196
|
'NUMERIC'=196
|
||||||
'OFFSET'=197
|
'OF'=197
|
||||||
'ON'=198
|
'OFFSET'=198
|
||||||
'ONLY'=199
|
'ON'=199
|
||||||
'OPTION'=200
|
'ONLY'=200
|
||||||
'OPTIONS'=201
|
'OPTION'=201
|
||||||
'OR'=202
|
'OPTIONS'=202
|
||||||
'ORDER'=203
|
'OR'=203
|
||||||
'OUT'=204
|
'ORDER'=204
|
||||||
'OUTER'=205
|
'OUT'=205
|
||||||
'OUTPUTFORMAT'=206
|
'OUTER'=206
|
||||||
'OVER'=207
|
'OUTPUTFORMAT'=207
|
||||||
'OVERLAPS'=208
|
'OVER'=208
|
||||||
'OVERLAY'=209
|
'OVERLAPS'=209
|
||||||
'OVERWRITE'=210
|
'OVERLAY'=210
|
||||||
'PARTITION'=211
|
'OVERWRITE'=211
|
||||||
'PARTITIONED'=212
|
'PARTITION'=212
|
||||||
'PARTITIONS'=213
|
'PARTITIONED'=213
|
||||||
'PERCENTILE_CONT'=214
|
'PARTITIONS'=214
|
||||||
'PERCENTILE_DISC'=215
|
'PERCENTILE_CONT'=215
|
||||||
'PERCENT'=216
|
'PERCENTILE_DISC'=216
|
||||||
'PIVOT'=217
|
'PERCENT'=217
|
||||||
'PLACING'=218
|
'PIVOT'=218
|
||||||
'POSITION'=219
|
'PLACING'=219
|
||||||
'PRECEDING'=220
|
'POSITION'=220
|
||||||
'PRIMARY'=221
|
'PRECEDING'=221
|
||||||
'PRINCIPALS'=222
|
'PRIMARY'=222
|
||||||
'PROPERTIES'=223
|
'PRINCIPALS'=223
|
||||||
'PURGE'=224
|
'PROPERTIES'=224
|
||||||
'QUARTER'=225
|
'PURGE'=225
|
||||||
'QUERY'=226
|
'QUARTER'=226
|
||||||
'RANGE'=227
|
'QUERY'=227
|
||||||
'REAL'=228
|
'RANGE'=228
|
||||||
'RECORDREADER'=229
|
'REAL'=229
|
||||||
'RECORDWRITER'=230
|
'RECORDREADER'=230
|
||||||
'RECOVER'=231
|
'RECORDWRITER'=231
|
||||||
'REDUCE'=232
|
'RECOVER'=232
|
||||||
'REFERENCES'=233
|
'REDUCE'=233
|
||||||
'REFRESH'=234
|
'REFERENCES'=234
|
||||||
'RENAME'=235
|
'REFRESH'=235
|
||||||
'REPAIR'=236
|
'RENAME'=236
|
||||||
'REPEATABLE'=237
|
'REPAIR'=237
|
||||||
'REPLACE'=238
|
'REPEATABLE'=238
|
||||||
'RESET'=239
|
'REPLACE'=239
|
||||||
'RESPECT'=240
|
'RESET'=240
|
||||||
'RESTRICT'=241
|
'RESPECT'=241
|
||||||
'REVOKE'=242
|
'RESTRICT'=242
|
||||||
'RIGHT'=243
|
'REVOKE'=243
|
||||||
'RLIKE'=244
|
'RIGHT'=244
|
||||||
'REGEXP'=245
|
'RLIKE'=245
|
||||||
'ROLE'=246
|
'REGEXP'=246
|
||||||
'ROLES'=247
|
'ROLE'=247
|
||||||
'ROLLBACK'=248
|
'ROLES'=248
|
||||||
'ROLLUP'=249
|
'ROLLBACK'=249
|
||||||
'ROW'=250
|
'ROLLUP'=250
|
||||||
'ROWS'=251
|
'ROW'=251
|
||||||
'SECOND'=252
|
'ROWS'=252
|
||||||
'SECONDS'=253
|
'SECOND'=253
|
||||||
'SCHEMA'=254
|
'SECONDS'=254
|
||||||
'SCHEMAS'=255
|
'SCHEMA'=255
|
||||||
'SELECT'=256
|
'SCHEMAS'=256
|
||||||
'SEMI'=257
|
'SELECT'=257
|
||||||
'SEPARATED'=258
|
'SEMI'=258
|
||||||
'SERDE'=259
|
'SEPARATED'=259
|
||||||
'SERDEPROPERTIES'=260
|
'SERDE'=260
|
||||||
'SESSION_USER'=261
|
'SERDEPROPERTIES'=261
|
||||||
'SET'=262
|
'SESSION_USER'=262
|
||||||
'MINUS'=263
|
'SET'=263
|
||||||
'SETS'=264
|
'MINUS'=264
|
||||||
'SHORT'=265
|
'SETS'=265
|
||||||
'SHOW'=266
|
'SHORT'=266
|
||||||
'SINGLE'=267
|
'SHOW'=267
|
||||||
'SKEWED'=268
|
'SINGLE'=268
|
||||||
'SMALLINT'=269
|
'SKEWED'=269
|
||||||
'SOME'=270
|
'SMALLINT'=270
|
||||||
'SORT'=271
|
'SOME'=271
|
||||||
'SORTED'=272
|
'SORT'=272
|
||||||
'SOURCE'=273
|
'SORTED'=273
|
||||||
'START'=274
|
'SOURCE'=274
|
||||||
'STATISTICS'=275
|
'START'=275
|
||||||
'STORED'=276
|
'STATISTICS'=276
|
||||||
'STRATIFY'=277
|
'STORED'=277
|
||||||
'STRING'=278
|
'STRATIFY'=278
|
||||||
'STRUCT'=279
|
'STRING'=279
|
||||||
'SUBSTR'=280
|
'STRUCT'=280
|
||||||
'SUBSTRING'=281
|
'SUBSTR'=281
|
||||||
'SYNC'=282
|
'SUBSTRING'=282
|
||||||
'SYSTEM'=283
|
'SYNC'=283
|
||||||
'SYSTEM_TIME'=284
|
'SYSTEM'=284
|
||||||
'SYSTEM_VERSION'=285
|
'SYSTEM_TIME'=285
|
||||||
'TABLE'=286
|
'SYSTEM_VERSION'=286
|
||||||
'TABLES'=287
|
'TABLE'=287
|
||||||
'TABLESAMPLE'=288
|
'TABLES'=288
|
||||||
'TARGET'=289
|
'TABLESAMPLE'=289
|
||||||
'TBLPROPERTIES'=290
|
'TARGET'=290
|
||||||
'TEMPORARY'=291
|
'TBLPROPERTIES'=291
|
||||||
'TERMINATED'=292
|
'TEMPORARY'=292
|
||||||
'THEN'=293
|
'TERMINATED'=293
|
||||||
'TIME'=294
|
'THEN'=294
|
||||||
'TIMEDIFF'=295
|
'TIME'=295
|
||||||
'TIMESTAMP'=296
|
'TIMEDIFF'=296
|
||||||
'TIMESTAMP_LTZ'=297
|
'TIMESTAMP'=297
|
||||||
'TIMESTAMP_NTZ'=298
|
'TIMESTAMP_LTZ'=298
|
||||||
'TIMESTAMPADD'=299
|
'TIMESTAMP_NTZ'=299
|
||||||
'TIMESTAMPDIFF'=300
|
'TIMESTAMPADD'=300
|
||||||
'TINYINT'=301
|
'TIMESTAMPDIFF'=301
|
||||||
'TO'=302
|
'TINYINT'=302
|
||||||
'TOUCH'=303
|
'TO'=303
|
||||||
'TRAILING'=304
|
'TOUCH'=304
|
||||||
'TRANSACTION'=305
|
'TRAILING'=305
|
||||||
'TRANSACTIONS'=306
|
'TRANSACTION'=306
|
||||||
'TRANSFORM'=307
|
'TRANSACTIONS'=307
|
||||||
'TRIM'=308
|
'TRANSFORM'=308
|
||||||
'TRUE'=309
|
'TRIM'=309
|
||||||
'TRUNCATE'=310
|
'TRUE'=310
|
||||||
'TRY_CAST'=311
|
'TRUNCATE'=311
|
||||||
'TYPE'=312
|
'TRY_CAST'=312
|
||||||
'UNARCHIVE'=313
|
'TYPE'=313
|
||||||
'UNBOUNDED'=314
|
'UNARCHIVE'=314
|
||||||
'UNCACHE'=315
|
'UNBOUNDED'=315
|
||||||
'UNION'=316
|
'UNCACHE'=316
|
||||||
'UNIQUE'=317
|
'UNION'=317
|
||||||
'UNKNOWN'=318
|
'UNIQUE'=318
|
||||||
'UNLOCK'=319
|
'UNKNOWN'=319
|
||||||
'UNPIVOT'=320
|
'UNLOCK'=320
|
||||||
'UNSET'=321
|
'UNPIVOT'=321
|
||||||
'UPDATE'=322
|
'UNSET'=322
|
||||||
'USE'=323
|
'UPDATE'=323
|
||||||
'USER'=324
|
'USE'=324
|
||||||
'USING'=325
|
'USER'=325
|
||||||
'VALUES'=326
|
'USING'=326
|
||||||
'VARCHAR'=327
|
'VALUES'=327
|
||||||
'VAR'=328
|
'VARCHAR'=328
|
||||||
'VARIABLE'=329
|
'VAR'=329
|
||||||
'VERSION'=330
|
'VARIABLE'=330
|
||||||
'VIEW'=331
|
'VERSION'=331
|
||||||
'VIEWS'=332
|
'VIEW'=332
|
||||||
'VOID'=333
|
'VIEWS'=333
|
||||||
'WEEK'=334
|
'VOID'=334
|
||||||
'WEEKS'=335
|
'WEEK'=335
|
||||||
'WHEN'=336
|
'WEEKS'=336
|
||||||
'WHERE'=337
|
'WHEN'=337
|
||||||
'WINDOW'=338
|
'WHERE'=338
|
||||||
'WITH'=339
|
'WINDOW'=339
|
||||||
'WITHIN'=340
|
'WITH'=340
|
||||||
'YEAR'=341
|
'WITHIN'=341
|
||||||
'YEARS'=342
|
'YEAR'=342
|
||||||
'ZONE'=343
|
'YEARS'=343
|
||||||
'<=>'=345
|
'ZONE'=344
|
||||||
'<>'=346
|
'<=>'=346
|
||||||
'!='=347
|
'<>'=347
|
||||||
'<'=348
|
'!='=348
|
||||||
'>'=350
|
'<'=349
|
||||||
'!'=352
|
'>'=351
|
||||||
'+'=353
|
'!'=353
|
||||||
'-'=354
|
'+'=354
|
||||||
'*'=355
|
'-'=355
|
||||||
'/'=356
|
'*'=356
|
||||||
'%'=357
|
'/'=357
|
||||||
'~'=358
|
'%'=358
|
||||||
'&'=359
|
'~'=359
|
||||||
'|'=360
|
'&'=360
|
||||||
'||'=361
|
'|'=361
|
||||||
'^'=362
|
'||'=362
|
||||||
':'=363
|
'^'=363
|
||||||
'->'=364
|
':'=364
|
||||||
'=>'=365
|
'->'=365
|
||||||
'/*+'=366
|
'=>'=366
|
||||||
'*/'=367
|
'/*+'=367
|
||||||
'?'=368
|
'*/'=368
|
||||||
|
'?'=369
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
|||||||
// Generated from /Users/liuyi/Desktop/Projects/dtstack/dt-sql-parser/src/grammar/spark/SparkSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
// Generated from /Users/hayden/Desktop/dt-works/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";
|
||||||
@ -48,6 +48,9 @@ import { TableNameCreateContext } from "./SparkSqlParser";
|
|||||||
import { TableNameContext } from "./SparkSqlParser";
|
import { TableNameContext } from "./SparkSqlParser";
|
||||||
import { ViewNameCreateContext } from "./SparkSqlParser";
|
import { ViewNameCreateContext } from "./SparkSqlParser";
|
||||||
import { ViewNameContext } from "./SparkSqlParser";
|
import { ViewNameContext } from "./SparkSqlParser";
|
||||||
|
import { ColumnNameContext } from "./SparkSqlParser";
|
||||||
|
import { ColumnNameSeqContext } from "./SparkSqlParser";
|
||||||
|
import { ColumnNameCreateContext } 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";
|
||||||
@ -159,8 +162,10 @@ import { UnitInUnitToUnitContext } from "./SparkSqlParser";
|
|||||||
import { ColPositionContext } from "./SparkSqlParser";
|
import { ColPositionContext } from "./SparkSqlParser";
|
||||||
import { TypeContext } from "./SparkSqlParser";
|
import { TypeContext } from "./SparkSqlParser";
|
||||||
import { DataTypeContext } from "./SparkSqlParser";
|
import { DataTypeContext } from "./SparkSqlParser";
|
||||||
import { QualifiedColTypeWithPositionListContext } from "./SparkSqlParser";
|
import { QualifiedColTypeWithPositionSeqForAddContext } from "./SparkSqlParser";
|
||||||
import { QualifiedColTypeWithPositionContext } from "./SparkSqlParser";
|
import { QualifiedColTypeWithPositionForAddContext } from "./SparkSqlParser";
|
||||||
|
import { QualifiedColTypeWithPositionSeqForReplaceContext } from "./SparkSqlParser";
|
||||||
|
import { QualifiedColTypeWithPositionForReplaceContext } from "./SparkSqlParser";
|
||||||
import { ColDefinitionDescriptorWithPositionContext } from "./SparkSqlParser";
|
import { ColDefinitionDescriptorWithPositionContext } from "./SparkSqlParser";
|
||||||
import { DefaultExpressionContext } from "./SparkSqlParser";
|
import { DefaultExpressionContext } from "./SparkSqlParser";
|
||||||
import { VariableDefaultExpressionContext } from "./SparkSqlParser";
|
import { VariableDefaultExpressionContext } from "./SparkSqlParser";
|
||||||
@ -698,6 +703,39 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitViewName?: (ctx: ViewNameContext) => void;
|
exitViewName?: (ctx: ViewNameContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.columnName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterColumnName?: (ctx: ColumnNameContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.columnName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitColumnName?: (ctx: ColumnNameContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.columnNameSeq`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterColumnNameSeq?: (ctx: ColumnNameSeqContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.columnNameSeq`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitColumnNameSeq?: (ctx: ColumnNameSeqContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterColumnNameCreate?: (ctx: ColumnNameCreateContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitColumnNameCreate?: (ctx: ColumnNameCreateContext) => 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
|
||||||
@ -1920,26 +1958,48 @@ export interface SparkSqlParserListener extends ParseTreeListener {
|
|||||||
exitDataType?: (ctx: DataTypeContext) => void;
|
exitDataType?: (ctx: DataTypeContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionList`.
|
* Enter a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionSeqForAdd`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
enterQualifiedColTypeWithPositionList?: (ctx: QualifiedColTypeWithPositionListContext) => void;
|
enterQualifiedColTypeWithPositionSeqForAdd?: (ctx: QualifiedColTypeWithPositionSeqForAddContext) => void;
|
||||||
/**
|
/**
|
||||||
* Exit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionList`.
|
* Exit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionSeqForAdd`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
exitQualifiedColTypeWithPositionList?: (ctx: QualifiedColTypeWithPositionListContext) => void;
|
exitQualifiedColTypeWithPositionSeqForAdd?: (ctx: QualifiedColTypeWithPositionSeqForAddContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPosition`.
|
* Enter a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionForAdd`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
enterQualifiedColTypeWithPosition?: (ctx: QualifiedColTypeWithPositionContext) => void;
|
enterQualifiedColTypeWithPositionForAdd?: (ctx: QualifiedColTypeWithPositionForAddContext) => void;
|
||||||
/**
|
/**
|
||||||
* Exit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPosition`.
|
* Exit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionForAdd`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
*/
|
*/
|
||||||
exitQualifiedColTypeWithPosition?: (ctx: QualifiedColTypeWithPositionContext) => void;
|
exitQualifiedColTypeWithPositionForAdd?: (ctx: QualifiedColTypeWithPositionForAddContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionSeqForReplace`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterQualifiedColTypeWithPositionSeqForReplace?: (ctx: QualifiedColTypeWithPositionSeqForReplaceContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionSeqForReplace`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitQualifiedColTypeWithPositionSeqForReplace?: (ctx: QualifiedColTypeWithPositionSeqForReplaceContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionForReplace`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterQualifiedColTypeWithPositionForReplace?: (ctx: QualifiedColTypeWithPositionForReplaceContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionForReplace`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitQualifiedColTypeWithPositionForReplace?: (ctx: QualifiedColTypeWithPositionForReplaceContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `SparkSqlParser.colDefinitionDescriptorWithPosition`.
|
* Enter a parse tree produced by `SparkSqlParser.colDefinitionDescriptorWithPosition`.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Generated from /Users/liuyi/Desktop/Projects/dtstack/dt-sql-parser/src/grammar/spark/SparkSqlParser.g4 by ANTLR 4.9.0-SNAPSHOT
|
// Generated from /Users/hayden/Desktop/dt-works/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";
|
||||||
@ -48,6 +48,9 @@ import { TableNameCreateContext } from "./SparkSqlParser";
|
|||||||
import { TableNameContext } from "./SparkSqlParser";
|
import { TableNameContext } from "./SparkSqlParser";
|
||||||
import { ViewNameCreateContext } from "./SparkSqlParser";
|
import { ViewNameCreateContext } from "./SparkSqlParser";
|
||||||
import { ViewNameContext } from "./SparkSqlParser";
|
import { ViewNameContext } from "./SparkSqlParser";
|
||||||
|
import { ColumnNameContext } from "./SparkSqlParser";
|
||||||
|
import { ColumnNameSeqContext } from "./SparkSqlParser";
|
||||||
|
import { ColumnNameCreateContext } 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";
|
||||||
@ -159,8 +162,10 @@ import { UnitInUnitToUnitContext } from "./SparkSqlParser";
|
|||||||
import { ColPositionContext } from "./SparkSqlParser";
|
import { ColPositionContext } from "./SparkSqlParser";
|
||||||
import { TypeContext } from "./SparkSqlParser";
|
import { TypeContext } from "./SparkSqlParser";
|
||||||
import { DataTypeContext } from "./SparkSqlParser";
|
import { DataTypeContext } from "./SparkSqlParser";
|
||||||
import { QualifiedColTypeWithPositionListContext } from "./SparkSqlParser";
|
import { QualifiedColTypeWithPositionSeqForAddContext } from "./SparkSqlParser";
|
||||||
import { QualifiedColTypeWithPositionContext } from "./SparkSqlParser";
|
import { QualifiedColTypeWithPositionForAddContext } from "./SparkSqlParser";
|
||||||
|
import { QualifiedColTypeWithPositionSeqForReplaceContext } from "./SparkSqlParser";
|
||||||
|
import { QualifiedColTypeWithPositionForReplaceContext } from "./SparkSqlParser";
|
||||||
import { ColDefinitionDescriptorWithPositionContext } from "./SparkSqlParser";
|
import { ColDefinitionDescriptorWithPositionContext } from "./SparkSqlParser";
|
||||||
import { DefaultExpressionContext } from "./SparkSqlParser";
|
import { DefaultExpressionContext } from "./SparkSqlParser";
|
||||||
import { VariableDefaultExpressionContext } from "./SparkSqlParser";
|
import { VariableDefaultExpressionContext } from "./SparkSqlParser";
|
||||||
@ -521,6 +526,27 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
|
|||||||
*/
|
*/
|
||||||
visitViewName?: (ctx: ViewNameContext) => Result;
|
visitViewName?: (ctx: ViewNameContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.columnName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitColumnName?: (ctx: ColumnNameContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.columnNameSeq`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitColumnNameSeq?: (ctx: ColumnNameSeqContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitColumnNameCreate?: (ctx: ColumnNameCreateContext) => 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
|
||||||
@ -1299,18 +1325,32 @@ export interface SparkSqlParserVisitor<Result> extends ParseTreeVisitor<Result>
|
|||||||
visitDataType?: (ctx: DataTypeContext) => Result;
|
visitDataType?: (ctx: DataTypeContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionList`.
|
* Visit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionSeqForAdd`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
* @return the visitor result
|
* @return the visitor result
|
||||||
*/
|
*/
|
||||||
visitQualifiedColTypeWithPositionList?: (ctx: QualifiedColTypeWithPositionListContext) => Result;
|
visitQualifiedColTypeWithPositionSeqForAdd?: (ctx: QualifiedColTypeWithPositionSeqForAddContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPosition`.
|
* Visit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionForAdd`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
* @return the visitor result
|
* @return the visitor result
|
||||||
*/
|
*/
|
||||||
visitQualifiedColTypeWithPosition?: (ctx: QualifiedColTypeWithPositionContext) => Result;
|
visitQualifiedColTypeWithPositionForAdd?: (ctx: QualifiedColTypeWithPositionForAddContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionSeqForReplace`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitQualifiedColTypeWithPositionSeqForReplace?: (ctx: QualifiedColTypeWithPositionSeqForReplaceContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `SparkSqlParser.qualifiedColTypeWithPositionForReplace`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitQualifiedColTypeWithPositionForReplace?: (ctx: QualifiedColTypeWithPositionForReplaceContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `SparkSqlParser.colDefinitionDescriptorWithPosition`.
|
* Visit a parse tree produced by `SparkSqlParser.colDefinitionDescriptorWithPosition`.
|
||||||
|
File diff suppressed because one or more lines are too long
@ -228,6 +228,7 @@ import { QuerySpecificationContext } from "./TrinoSqlParser";
|
|||||||
import { GroupByContext } from "./TrinoSqlParser";
|
import { GroupByContext } from "./TrinoSqlParser";
|
||||||
import { GroupingElementContext } from "./TrinoSqlParser";
|
import { GroupingElementContext } from "./TrinoSqlParser";
|
||||||
import { GroupingSetContext } from "./TrinoSqlParser";
|
import { GroupingSetContext } from "./TrinoSqlParser";
|
||||||
|
import { GroupingTermContext } from "./TrinoSqlParser";
|
||||||
import { WindowDefinitionContext } from "./TrinoSqlParser";
|
import { WindowDefinitionContext } from "./TrinoSqlParser";
|
||||||
import { WindowSpecificationContext } from "./TrinoSqlParser";
|
import { WindowSpecificationContext } from "./TrinoSqlParser";
|
||||||
import { NamedQueryContext } from "./TrinoSqlParser";
|
import { NamedQueryContext } from "./TrinoSqlParser";
|
||||||
@ -246,6 +247,8 @@ import { SkipToContext } from "./TrinoSqlParser";
|
|||||||
import { SubsetDefinitionContext } from "./TrinoSqlParser";
|
import { SubsetDefinitionContext } from "./TrinoSqlParser";
|
||||||
import { VariableDefinitionContext } from "./TrinoSqlParser";
|
import { VariableDefinitionContext } from "./TrinoSqlParser";
|
||||||
import { AliasedRelationContext } from "./TrinoSqlParser";
|
import { AliasedRelationContext } from "./TrinoSqlParser";
|
||||||
|
import { ColumnListCreateContext } from "./TrinoSqlParser";
|
||||||
|
import { ColumnListContext } from "./TrinoSqlParser";
|
||||||
import { ColumnAliasesContext } from "./TrinoSqlParser";
|
import { ColumnAliasesContext } from "./TrinoSqlParser";
|
||||||
import { RelationPrimaryContext } from "./TrinoSqlParser";
|
import { RelationPrimaryContext } from "./TrinoSqlParser";
|
||||||
import { ExpressionContext } from "./TrinoSqlParser";
|
import { ExpressionContext } from "./TrinoSqlParser";
|
||||||
@ -297,6 +300,8 @@ import { SchemaPathContext } from "./TrinoSqlParser";
|
|||||||
import { CatalogNameContext } from "./TrinoSqlParser";
|
import { CatalogNameContext } from "./TrinoSqlParser";
|
||||||
import { CatalogNameCreateContext } from "./TrinoSqlParser";
|
import { CatalogNameCreateContext } from "./TrinoSqlParser";
|
||||||
import { FunctionNameContext } from "./TrinoSqlParser";
|
import { FunctionNameContext } from "./TrinoSqlParser";
|
||||||
|
import { ColumnNameContext } from "./TrinoSqlParser";
|
||||||
|
import { ColumnNameCreateContext } from "./TrinoSqlParser";
|
||||||
import { QualifiedNameContext } from "./TrinoSqlParser";
|
import { QualifiedNameContext } from "./TrinoSqlParser";
|
||||||
import { GrantorContext } from "./TrinoSqlParser";
|
import { GrantorContext } from "./TrinoSqlParser";
|
||||||
import { PrincipalContext } from "./TrinoSqlParser";
|
import { PrincipalContext } from "./TrinoSqlParser";
|
||||||
@ -3182,6 +3187,17 @@ export interface TrinoSqlListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitGroupingSet?: (ctx: GroupingSetContext) => void;
|
exitGroupingSet?: (ctx: GroupingSetContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `TrinoSqlParser.groupingTerm`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterGroupingTerm?: (ctx: GroupingTermContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `TrinoSqlParser.groupingTerm`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitGroupingTerm?: (ctx: GroupingTermContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `TrinoSqlParser.windowDefinition`.
|
* Enter a parse tree produced by `TrinoSqlParser.windowDefinition`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -3380,6 +3396,28 @@ export interface TrinoSqlListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitAliasedRelation?: (ctx: AliasedRelationContext) => void;
|
exitAliasedRelation?: (ctx: AliasedRelationContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `TrinoSqlParser.columnListCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterColumnListCreate?: (ctx: ColumnListCreateContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `TrinoSqlParser.columnListCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitColumnListCreate?: (ctx: ColumnListCreateContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `TrinoSqlParser.columnList`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterColumnList?: (ctx: ColumnListContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `TrinoSqlParser.columnList`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitColumnList?: (ctx: ColumnListContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `TrinoSqlParser.columnAliases`.
|
* Enter a parse tree produced by `TrinoSqlParser.columnAliases`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -3941,6 +3979,28 @@ export interface TrinoSqlListener extends ParseTreeListener {
|
|||||||
*/
|
*/
|
||||||
exitFunctionName?: (ctx: FunctionNameContext) => void;
|
exitFunctionName?: (ctx: FunctionNameContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `TrinoSqlParser.columnName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterColumnName?: (ctx: ColumnNameContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `TrinoSqlParser.columnName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitColumnName?: (ctx: ColumnNameContext) => void;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enter a parse tree produced by `TrinoSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
enterColumnNameCreate?: (ctx: ColumnNameCreateContext) => void;
|
||||||
|
/**
|
||||||
|
* Exit a parse tree produced by `TrinoSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
*/
|
||||||
|
exitColumnNameCreate?: (ctx: ColumnNameCreateContext) => void;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Enter a parse tree produced by `TrinoSqlParser.qualifiedName`.
|
* Enter a parse tree produced by `TrinoSqlParser.qualifiedName`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
File diff suppressed because one or more lines are too long
@ -228,6 +228,7 @@ import { QuerySpecificationContext } from "./TrinoSqlParser";
|
|||||||
import { GroupByContext } from "./TrinoSqlParser";
|
import { GroupByContext } from "./TrinoSqlParser";
|
||||||
import { GroupingElementContext } from "./TrinoSqlParser";
|
import { GroupingElementContext } from "./TrinoSqlParser";
|
||||||
import { GroupingSetContext } from "./TrinoSqlParser";
|
import { GroupingSetContext } from "./TrinoSqlParser";
|
||||||
|
import { GroupingTermContext } from "./TrinoSqlParser";
|
||||||
import { WindowDefinitionContext } from "./TrinoSqlParser";
|
import { WindowDefinitionContext } from "./TrinoSqlParser";
|
||||||
import { WindowSpecificationContext } from "./TrinoSqlParser";
|
import { WindowSpecificationContext } from "./TrinoSqlParser";
|
||||||
import { NamedQueryContext } from "./TrinoSqlParser";
|
import { NamedQueryContext } from "./TrinoSqlParser";
|
||||||
@ -246,6 +247,8 @@ import { SkipToContext } from "./TrinoSqlParser";
|
|||||||
import { SubsetDefinitionContext } from "./TrinoSqlParser";
|
import { SubsetDefinitionContext } from "./TrinoSqlParser";
|
||||||
import { VariableDefinitionContext } from "./TrinoSqlParser";
|
import { VariableDefinitionContext } from "./TrinoSqlParser";
|
||||||
import { AliasedRelationContext } from "./TrinoSqlParser";
|
import { AliasedRelationContext } from "./TrinoSqlParser";
|
||||||
|
import { ColumnListCreateContext } from "./TrinoSqlParser";
|
||||||
|
import { ColumnListContext } from "./TrinoSqlParser";
|
||||||
import { ColumnAliasesContext } from "./TrinoSqlParser";
|
import { ColumnAliasesContext } from "./TrinoSqlParser";
|
||||||
import { RelationPrimaryContext } from "./TrinoSqlParser";
|
import { RelationPrimaryContext } from "./TrinoSqlParser";
|
||||||
import { ExpressionContext } from "./TrinoSqlParser";
|
import { ExpressionContext } from "./TrinoSqlParser";
|
||||||
@ -297,6 +300,8 @@ import { SchemaPathContext } from "./TrinoSqlParser";
|
|||||||
import { CatalogNameContext } from "./TrinoSqlParser";
|
import { CatalogNameContext } from "./TrinoSqlParser";
|
||||||
import { CatalogNameCreateContext } from "./TrinoSqlParser";
|
import { CatalogNameCreateContext } from "./TrinoSqlParser";
|
||||||
import { FunctionNameContext } from "./TrinoSqlParser";
|
import { FunctionNameContext } from "./TrinoSqlParser";
|
||||||
|
import { ColumnNameContext } from "./TrinoSqlParser";
|
||||||
|
import { ColumnNameCreateContext } from "./TrinoSqlParser";
|
||||||
import { QualifiedNameContext } from "./TrinoSqlParser";
|
import { QualifiedNameContext } from "./TrinoSqlParser";
|
||||||
import { GrantorContext } from "./TrinoSqlParser";
|
import { GrantorContext } from "./TrinoSqlParser";
|
||||||
import { PrincipalContext } from "./TrinoSqlParser";
|
import { PrincipalContext } from "./TrinoSqlParser";
|
||||||
@ -2087,6 +2092,13 @@ export interface TrinoSqlVisitor<Result> extends ParseTreeVisitor<Result> {
|
|||||||
*/
|
*/
|
||||||
visitGroupingSet?: (ctx: GroupingSetContext) => Result;
|
visitGroupingSet?: (ctx: GroupingSetContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `TrinoSqlParser.groupingTerm`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitGroupingTerm?: (ctx: GroupingTermContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `TrinoSqlParser.windowDefinition`.
|
* Visit a parse tree produced by `TrinoSqlParser.windowDefinition`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -2213,6 +2225,20 @@ export interface TrinoSqlVisitor<Result> extends ParseTreeVisitor<Result> {
|
|||||||
*/
|
*/
|
||||||
visitAliasedRelation?: (ctx: AliasedRelationContext) => Result;
|
visitAliasedRelation?: (ctx: AliasedRelationContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `TrinoSqlParser.columnListCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitColumnListCreate?: (ctx: ColumnListCreateContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `TrinoSqlParser.columnList`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitColumnList?: (ctx: ColumnListContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `TrinoSqlParser.columnAliases`.
|
* Visit a parse tree produced by `TrinoSqlParser.columnAliases`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
@ -2570,6 +2596,20 @@ export interface TrinoSqlVisitor<Result> extends ParseTreeVisitor<Result> {
|
|||||||
*/
|
*/
|
||||||
visitFunctionName?: (ctx: FunctionNameContext) => Result;
|
visitFunctionName?: (ctx: FunctionNameContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `TrinoSqlParser.columnName`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitColumnName?: (ctx: ColumnNameContext) => Result;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visit a parse tree produced by `TrinoSqlParser.columnNameCreate`.
|
||||||
|
* @param ctx the parse tree
|
||||||
|
* @return the visitor result
|
||||||
|
*/
|
||||||
|
visitColumnNameCreate?: (ctx: ColumnNameCreateContext) => Result;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Visit a parse tree produced by `TrinoSqlParser.qualifiedName`.
|
* Visit a parse tree produced by `TrinoSqlParser.qualifiedName`.
|
||||||
* @param ctx the parse tree
|
* @param ctx the parse tree
|
||||||
|
@ -32,6 +32,8 @@ export default class FlinkSQL extends BasicParser<FlinkSqlLexer, ProgramContext,
|
|||||||
FlinkSqlParser.RULE_viewPathCreate, // viewName that will be created
|
FlinkSqlParser.RULE_viewPathCreate, // viewName that will be created
|
||||||
FlinkSqlParser.RULE_functionName, // functionName
|
FlinkSqlParser.RULE_functionName, // functionName
|
||||||
FlinkSqlParser.RULE_functionNameCreate, // functionName that will be created
|
FlinkSqlParser.RULE_functionNameCreate, // functionName that will be created
|
||||||
|
FlinkSqlParser.RULE_columnName,
|
||||||
|
FlinkSqlParser.RULE_columnNameCreate,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
protected get splitListener() {
|
protected get splitListener() {
|
||||||
@ -93,6 +95,14 @@ export default class FlinkSQL extends BasicParser<FlinkSqlLexer, ProgramContext,
|
|||||||
syntaxContextType = SyntaxContextType.FUNCTION_CREATE;
|
syntaxContextType = SyntaxContextType.FUNCTION_CREATE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case FlinkSqlParser.RULE_columnName: {
|
||||||
|
syntaxContextType = SyntaxContextType.COLUMN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case FlinkSqlParser.RULE_columnNameCreate: {
|
||||||
|
syntaxContextType = SyntaxContextType.COLUMN_CREATE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ export default class HiveSQL extends BasicParser<HiveSqlLexer, ProgramContext, H
|
|||||||
HiveSqlParser.RULE_functionNameForDDL, // function name
|
HiveSqlParser.RULE_functionNameForDDL, // function name
|
||||||
HiveSqlParser.RULE_functionNameForInvoke, // function name
|
HiveSqlParser.RULE_functionNameForInvoke, // function name
|
||||||
HiveSqlParser.RULE_functionNameCreate, // function name that will be created
|
HiveSqlParser.RULE_functionNameCreate, // function name that will be created
|
||||||
|
HiveSqlParser.RULE_columnName,
|
||||||
|
HiveSqlParser.RULE_columnNameCreate,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
protected get splitListener() {
|
protected get splitListener() {
|
||||||
@ -83,6 +85,14 @@ export default class HiveSQL extends BasicParser<HiveSqlLexer, ProgramContext, H
|
|||||||
syntaxContextType = SyntaxContextType.FUNCTION_CREATE;
|
syntaxContextType = SyntaxContextType.FUNCTION_CREATE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case HiveSqlParser.RULE_columnName: {
|
||||||
|
syntaxContextType = SyntaxContextType.COLUMN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case HiveSqlParser.RULE_columnNameCreate: {
|
||||||
|
syntaxContextType = SyntaxContextType.COLUMN_CREATE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ export default class SparkSQL extends BasicParser<SparkSqlLexer, ProgramContext,
|
|||||||
SparkSqlParser.RULE_viewNameCreate,
|
SparkSqlParser.RULE_viewNameCreate,
|
||||||
SparkSqlParser.RULE_functionName,
|
SparkSqlParser.RULE_functionName,
|
||||||
SparkSqlParser.RULE_functionNameCreate,
|
SparkSqlParser.RULE_functionNameCreate,
|
||||||
|
SparkSqlParser.RULE_columnName,
|
||||||
|
SparkSqlParser.RULE_columnNameCreate,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
protected get splitListener() {
|
protected get splitListener() {
|
||||||
@ -87,6 +89,14 @@ export default class SparkSQL extends BasicParser<SparkSqlLexer, ProgramContext,
|
|||||||
syntaxContextType = SyntaxContextType.FUNCTION_CREATE;
|
syntaxContextType = SyntaxContextType.FUNCTION_CREATE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case SparkSqlParser.RULE_columnName: {
|
||||||
|
syntaxContextType = SyntaxContextType.COLUMN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case SparkSqlParser.RULE_columnNameCreate: {
|
||||||
|
syntaxContextType = SyntaxContextType.COLUMN_CREATE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,8 @@ export default class TrinoSQL extends BasicParser<TrinoSqlLexer, ProgramContext,
|
|||||||
TrinoSqlParser.RULE_viewName,
|
TrinoSqlParser.RULE_viewName,
|
||||||
TrinoSqlParser.RULE_viewNameCreate,
|
TrinoSqlParser.RULE_viewNameCreate,
|
||||||
TrinoSqlParser.RULE_functionName,
|
TrinoSqlParser.RULE_functionName,
|
||||||
|
TrinoSqlParser.RULE_columnName,
|
||||||
|
TrinoSqlParser.RULE_columnNameCreate,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
protected processCandidates(
|
protected processCandidates(
|
||||||
@ -84,6 +86,14 @@ export default class TrinoSQL extends BasicParser<TrinoSqlLexer, ProgramContext,
|
|||||||
syntaxContextType = SyntaxContextType.FUNCTION;
|
syntaxContextType = SyntaxContextType.FUNCTION;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case TrinoSqlParser.RULE_columnNameCreate: {
|
||||||
|
syntaxContextType = SyntaxContextType.COLUMN_CREATE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TrinoSqlParser.RULE_columnName: {
|
||||||
|
syntaxContextType = SyntaxContextType.COLUMN;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1,25 +1,41 @@
|
|||||||
DROP CATALOG cat;
|
DROP CATALOG cat;
|
||||||
;
|
|
||||||
SELECT * FROM cat. ;
|
SELECT * FROM cat. ;
|
||||||
;
|
|
||||||
CREATE TABLE cat.db ;
|
CREATE TABLE cat.db ;
|
||||||
;
|
|
||||||
SHOW TABLES FROM cat;
|
SHOW TABLES FROM cat;
|
||||||
;
|
|
||||||
ALTER DATABASE cat.;
|
ALTER DATABASE cat.;
|
||||||
;
|
|
||||||
DROP VIEW v;
|
DROP VIEW v;
|
||||||
;
|
|
||||||
SELECT * FROM ;
|
SELECT * FROM ;
|
||||||
;
|
|
||||||
CREATE VIEW cv;
|
CREATE VIEW cv;
|
||||||
;
|
|
||||||
SELECT name, calculate_age(birthdate) AS age FROM students;
|
SELECT name, calculate_age(birthdate) AS age FROM students;
|
||||||
;
|
|
||||||
CREATE FUNCTION fnc;
|
CREATE FUNCTION fnc;
|
||||||
;
|
|
||||||
SHOW COLUMNS FROM vie;
|
SHOW COLUMNS FROM vie;
|
||||||
;
|
|
||||||
SHOW CREATE TABLE tb1;
|
SHOW CREATE TABLE tb1;
|
||||||
|
|
||||||
SHOW CREATE VIEW v1;
|
SHOW CREATE VIEW v1;
|
||||||
|
|
||||||
|
SELECT col ;
|
||||||
|
|
||||||
|
SELECT col FROM tb1;
|
||||||
|
|
||||||
|
SELECT col, FROM tb1;
|
||||||
|
|
||||||
|
SELECT * FROM tb ORDER BY ;
|
||||||
|
|
||||||
|
SELECT * FROM tb GROUP BY tb. ;
|
||||||
|
|
||||||
|
INSERT INTO tb (col, tb.c );
|
||||||
|
|
||||||
|
CREATE TABLE yourTable (ts TIMESTAMP(3), WATERMARK FOR );
|
||||||
|
|
||||||
|
CREATE TABLE newTable ( );
|
@ -2,6 +2,7 @@ import fs from 'fs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||||
import FlinkSQL from '../../../../src/parser/flinksql';
|
import FlinkSQL from '../../../../src/parser/flinksql';
|
||||||
|
import { commentOtherLine } from '../../../helper';
|
||||||
|
|
||||||
const syntaxSql = fs.readFileSync(
|
const syntaxSql = fs.readFileSync(
|
||||||
path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'),
|
path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'),
|
||||||
@ -37,7 +38,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 1,
|
lineNumber: 1,
|
||||||
column: 17,
|
column: 17,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.CATALOG
|
(syn) => syn.syntaxContextType === SyntaxContextType.CATALOG
|
||||||
);
|
);
|
||||||
@ -51,7 +55,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 3,
|
lineNumber: 3,
|
||||||
column: 19,
|
column: 19,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
||||||
);
|
);
|
||||||
@ -65,7 +72,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 5,
|
lineNumber: 5,
|
||||||
column: 20,
|
column: 20,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE_CREATE
|
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE_CREATE
|
||||||
);
|
);
|
||||||
@ -79,7 +89,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 7,
|
lineNumber: 7,
|
||||||
column: 21,
|
column: 21,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE
|
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE
|
||||||
);
|
);
|
||||||
@ -93,7 +106,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 9,
|
lineNumber: 9,
|
||||||
column: 20,
|
column: 20,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE
|
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE
|
||||||
);
|
);
|
||||||
@ -107,7 +123,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 11,
|
lineNumber: 11,
|
||||||
column: 12,
|
column: 12,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
||||||
);
|
);
|
||||||
@ -121,7 +140,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 13,
|
lineNumber: 13,
|
||||||
column: 15,
|
column: 15,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
||||||
);
|
);
|
||||||
@ -135,7 +157,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 15,
|
lineNumber: 15,
|
||||||
column: 15,
|
column: 15,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW_CREATE
|
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW_CREATE
|
||||||
);
|
);
|
||||||
@ -149,7 +174,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 17,
|
lineNumber: 17,
|
||||||
column: 27,
|
column: 27,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION
|
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION
|
||||||
);
|
);
|
||||||
@ -163,7 +191,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 19,
|
lineNumber: 19,
|
||||||
column: 20,
|
column: 20,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION_CREATE
|
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION_CREATE
|
||||||
);
|
);
|
||||||
@ -177,7 +208,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 21,
|
lineNumber: 21,
|
||||||
column: 22,
|
column: 22,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
||||||
);
|
);
|
||||||
@ -191,7 +225,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 23,
|
lineNumber: 23,
|
||||||
column: 22,
|
column: 22,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
||||||
);
|
);
|
||||||
@ -205,7 +242,10 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 25,
|
lineNumber: 25,
|
||||||
column: 20,
|
column: 20,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
||||||
);
|
);
|
||||||
@ -213,4 +253,140 @@ describe('Flink SQL Syntax Suggestion', () => {
|
|||||||
expect(suggestion).not.toBeUndefined();
|
expect(suggestion).not.toBeUndefined();
|
||||||
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['v1']);
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['v1']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Select columns', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 27,
|
||||||
|
column: 11,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['col']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select columns from table', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 29,
|
||||||
|
column: 11,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['col']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select multiple columns from table', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 31,
|
||||||
|
column: 13,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select order by column', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 33,
|
||||||
|
column: 27,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select group by column', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 35,
|
||||||
|
column: 30,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['tb', '.']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Insert into spec columns', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 37,
|
||||||
|
column: 26,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['tb', '.', 'c']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Watermark for', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 39,
|
||||||
|
column: 56,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create table new columns', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 41,
|
||||||
|
column: 25,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN_CREATE
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -17,3 +17,19 @@ SELECT name, calculate_age(birthday) AS age FROM students;
|
|||||||
CREATE DATABASE db;
|
CREATE DATABASE db;
|
||||||
|
|
||||||
DROP SCHEMA IF EXISTS sch;
|
DROP SCHEMA IF EXISTS sch;
|
||||||
|
|
||||||
|
SELECT co;
|
||||||
|
|
||||||
|
SELECT ;
|
||||||
|
|
||||||
|
INSERT INTO tb ( );
|
||||||
|
|
||||||
|
SELECT * FROM tb1 ORDER BY tb.c;
|
||||||
|
|
||||||
|
CREATE TABLE newtb ( id INT, n );
|
||||||
|
|
||||||
|
MERGE INTO tablename USING tablename2 ON (tablename.id = tablename2.id) WHEN MATCHED THEN UPDATE SET tablename.col ;
|
||||||
|
|
||||||
|
ALTER TABLE tbl CHANGE COLUMN ;
|
||||||
|
|
||||||
|
ALTER TABLE tbl CHANGE COLUMN tbl.oldcol new ;
|
@ -2,6 +2,7 @@ import fs from 'fs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||||
import HiveSQL from '../../../../src/parser/hive';
|
import HiveSQL from '../../../../src/parser/hive';
|
||||||
|
import { commentOtherLine } from '../../../helper';
|
||||||
|
|
||||||
const syntaxSql = fs.readFileSync(
|
const syntaxSql = fs.readFileSync(
|
||||||
path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'),
|
path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'),
|
||||||
@ -22,7 +23,10 @@ describe('Hive SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 1,
|
lineNumber: 1,
|
||||||
column: 18,
|
column: 18,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
||||||
);
|
);
|
||||||
@ -36,7 +40,10 @@ describe('Hive SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 3,
|
lineNumber: 3,
|
||||||
column: 18,
|
column: 18,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
||||||
);
|
);
|
||||||
@ -50,7 +57,10 @@ describe('Hive SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 5,
|
lineNumber: 5,
|
||||||
column: 17,
|
column: 17,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE_CREATE
|
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE_CREATE
|
||||||
);
|
);
|
||||||
@ -64,7 +74,10 @@ describe('Hive SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 7,
|
lineNumber: 7,
|
||||||
column: 26,
|
column: 26,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
||||||
);
|
);
|
||||||
@ -78,7 +91,10 @@ describe('Hive SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 9,
|
lineNumber: 9,
|
||||||
column: 28,
|
column: 28,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW_CREATE
|
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW_CREATE
|
||||||
);
|
);
|
||||||
@ -92,7 +108,10 @@ describe('Hive SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 11,
|
lineNumber: 11,
|
||||||
column: 15,
|
column: 15,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
||||||
);
|
);
|
||||||
@ -106,7 +125,10 @@ describe('Hive SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 13,
|
lineNumber: 13,
|
||||||
column: 20,
|
column: 20,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION_CREATE
|
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION_CREATE
|
||||||
);
|
);
|
||||||
@ -120,7 +142,10 @@ describe('Hive SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 15,
|
lineNumber: 15,
|
||||||
column: 27,
|
column: 27,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION
|
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION
|
||||||
);
|
);
|
||||||
@ -134,7 +159,10 @@ describe('Hive SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 17,
|
lineNumber: 17,
|
||||||
column: 19,
|
column: 19,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE_CREATE
|
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE_CREATE
|
||||||
);
|
);
|
||||||
@ -148,7 +176,10 @@ describe('Hive SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 19,
|
lineNumber: 19,
|
||||||
column: 26,
|
column: 26,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE
|
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE
|
||||||
);
|
);
|
||||||
@ -156,4 +187,127 @@ describe('Hive SQL Syntax Suggestion', () => {
|
|||||||
expect(suggestion).not.toBeUndefined();
|
expect(suggestion).not.toBeUndefined();
|
||||||
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['sch']);
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['sch']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Select column with no fill-in', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 23,
|
||||||
|
column: 8,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Insert into spec col', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 25,
|
||||||
|
column: 18,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select order by', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 27,
|
||||||
|
column: 32,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['tb', '.', 'c']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Create Table new column', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 29,
|
||||||
|
column: 31,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN_CREATE
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['n']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Merge into when matched', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 31,
|
||||||
|
column: 115,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([
|
||||||
|
'tablename',
|
||||||
|
'.',
|
||||||
|
'col',
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Alter Table rename col', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 33,
|
||||||
|
column: 31,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Alter Table rename col to', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 35,
|
||||||
|
column: 45,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN_CREATE
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['new']);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -17,3 +17,33 @@ SELECT name, calculate_age(birthday) AS age FROM students;
|
|||||||
CREATE DATABASE db;
|
CREATE DATABASE db;
|
||||||
|
|
||||||
DROP SCHEMA IF EXISTS sch;
|
DROP SCHEMA IF EXISTS sch;
|
||||||
|
|
||||||
|
ANALYZE TABLE students COMPUTE STATISTICS FOR COLUMNS name, co ;
|
||||||
|
|
||||||
|
ALTER TABLE StudentInfo ADD COLUMNS (LastName string, );
|
||||||
|
|
||||||
|
ALTER TABLE StudentInfo RENAME COLUMN ;
|
||||||
|
|
||||||
|
ALTER TABLE StudentInfo RENAME COLUMN name TO t;
|
||||||
|
|
||||||
|
ALTER TABLE StudentInfo DROP COLUMNS (LastName, );
|
||||||
|
|
||||||
|
ALTER TABLE StudentInfo CHANGE FirstName;
|
||||||
|
|
||||||
|
INSERT INTO students ( );
|
||||||
|
|
||||||
|
INSERT INTO students ( id, n );
|
||||||
|
|
||||||
|
SELECT ;
|
||||||
|
|
||||||
|
SELECT id, n;
|
||||||
|
|
||||||
|
SELECT FROM tbl;
|
||||||
|
|
||||||
|
SELECT id, n FROM tbl;
|
||||||
|
|
||||||
|
SELECT id, n FROM tbl GROUP BY ;
|
||||||
|
|
||||||
|
SELECT id, n FROM tbl ORDER BY name, i ;
|
||||||
|
|
||||||
|
SELECT id FROM tb1 GROUP BY ROLLUP( );
|
@ -2,6 +2,7 @@ import fs from 'fs';
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
import { CaretPosition, SyntaxContextType } from '../../../../src/parser/common/basic-parser-types';
|
||||||
import SparkSQL from '../../../../src/parser/spark';
|
import SparkSQL from '../../../../src/parser/spark';
|
||||||
|
import { commentOtherLine } from '../../../helper';
|
||||||
|
|
||||||
const syntaxSql = fs.readFileSync(
|
const syntaxSql = fs.readFileSync(
|
||||||
path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'),
|
path.join(__dirname, 'fixtures', 'syntaxSuggestion.sql'),
|
||||||
@ -22,7 +23,10 @@ describe('Spark SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 1,
|
lineNumber: 1,
|
||||||
column: 18,
|
column: 18,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
||||||
);
|
);
|
||||||
@ -36,7 +40,10 @@ describe('Spark SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 3,
|
lineNumber: 3,
|
||||||
column: 18,
|
column: 18,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
||||||
);
|
);
|
||||||
@ -50,7 +57,10 @@ describe('Spark SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 5,
|
lineNumber: 5,
|
||||||
column: 17,
|
column: 17,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE_CREATE
|
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE_CREATE
|
||||||
);
|
);
|
||||||
@ -64,7 +74,10 @@ describe('Spark SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 7,
|
lineNumber: 7,
|
||||||
column: 26,
|
column: 26,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
(syn) => syn.syntaxContextType === SyntaxContextType.TABLE
|
||||||
);
|
);
|
||||||
@ -78,7 +91,10 @@ describe('Spark SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 9,
|
lineNumber: 9,
|
||||||
column: 28,
|
column: 28,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW_CREATE
|
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW_CREATE
|
||||||
);
|
);
|
||||||
@ -92,7 +108,10 @@ describe('Spark SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 11,
|
lineNumber: 11,
|
||||||
column: 15,
|
column: 15,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
(syn) => syn.syntaxContextType === SyntaxContextType.VIEW
|
||||||
);
|
);
|
||||||
@ -106,7 +125,10 @@ describe('Spark SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 13,
|
lineNumber: 13,
|
||||||
column: 20,
|
column: 20,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION_CREATE
|
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION_CREATE
|
||||||
);
|
);
|
||||||
@ -120,7 +142,10 @@ describe('Spark SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 15,
|
lineNumber: 15,
|
||||||
column: 27,
|
column: 27,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION
|
(syn) => syn.syntaxContextType === SyntaxContextType.FUNCTION
|
||||||
);
|
);
|
||||||
@ -134,7 +159,10 @@ describe('Spark SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 17,
|
lineNumber: 17,
|
||||||
column: 19,
|
column: 19,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE_CREATE
|
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE_CREATE
|
||||||
);
|
);
|
||||||
@ -148,7 +176,10 @@ describe('Spark SQL Syntax Suggestion', () => {
|
|||||||
lineNumber: 19,
|
lineNumber: 19,
|
||||||
column: 26,
|
column: 26,
|
||||||
};
|
};
|
||||||
const syntaxes = parser.getSuggestionAtCaretPosition(syntaxSql, pos)?.syntax;
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
const suggestion = syntaxes?.find(
|
const suggestion = syntaxes?.find(
|
||||||
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE
|
(syn) => syn.syntaxContextType === SyntaxContextType.DATABASE
|
||||||
);
|
);
|
||||||
@ -156,4 +187,259 @@ describe('Spark SQL Syntax Suggestion', () => {
|
|||||||
expect(suggestion).not.toBeUndefined();
|
expect(suggestion).not.toBeUndefined();
|
||||||
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['sch']);
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['sch']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('ANALYZE table for columns', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 21,
|
||||||
|
column: 63,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['co']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Alter table add columns', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 23,
|
||||||
|
column: 55,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN_CREATE
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Alter table rename columns', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 25,
|
||||||
|
column: 39,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Alter table rename columns to', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 27,
|
||||||
|
column: 48,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN_CREATE
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['t']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Alter table drop columns', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 29,
|
||||||
|
column: 49,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Alter table change columns', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 31,
|
||||||
|
column: 41,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['FirstName']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Insert into table spec columns', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 33,
|
||||||
|
column: 24,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Insert into table spec columns2', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 35,
|
||||||
|
column: 29,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['n']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select columns case empty', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 37,
|
||||||
|
column: 8,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select columns case seq', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 39,
|
||||||
|
column: 13,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['n']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select columns from table case empty', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 41,
|
||||||
|
column: 8,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select columns from table case seq', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 43,
|
||||||
|
column: 13,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['n']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select group by', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 45,
|
||||||
|
column: 32,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select group by', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 47,
|
||||||
|
column: 39,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['i']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select group by rollup', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 49,
|
||||||
|
column: 37,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -17,3 +17,21 @@ CREATE SCHEMA db ;
|
|||||||
DROP SCHEMA IF EXISTS sch;
|
DROP SCHEMA IF EXISTS sch;
|
||||||
|
|
||||||
SHOW COLUMNS FROM tb ;
|
SHOW COLUMNS FROM tb ;
|
||||||
|
|
||||||
|
COMMENT ON COLUMN tb.;
|
||||||
|
|
||||||
|
ALTER TABLE tb RENAME COLUMN ;
|
||||||
|
|
||||||
|
ALTER TABLE tb RENAME COLUMN ids TO ;
|
||||||
|
|
||||||
|
ALTER TABLE users DROP COLUMN ;
|
||||||
|
|
||||||
|
ALTER TABLE users ADD COLUMN zi ;
|
||||||
|
|
||||||
|
SHOW COMMENT ON COLUMN tb.c ;
|
||||||
|
|
||||||
|
INSERT INTO tb (id, );
|
||||||
|
|
||||||
|
SELECT * FROM tb ORDER BY ;
|
||||||
|
|
||||||
|
SELECT * FROM tb GROUP BY ;
|
||||||
|
@ -198,4 +198,161 @@ describe('Trino SQL Syntax Suggestion', () => {
|
|||||||
expect(suggestion).not.toBeUndefined();
|
expect(suggestion).not.toBeUndefined();
|
||||||
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['tb']);
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['tb']);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Comment on column', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 21,
|
||||||
|
column: 22,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['tb', '.']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('RENAME column', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 23,
|
||||||
|
column: 30,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('RENAME column to', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 25,
|
||||||
|
column: 37,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN_CREATE
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Drop column', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 27,
|
||||||
|
column: 31,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Alter table add column', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 29,
|
||||||
|
column: 32,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN_CREATE
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['zi']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Show comment on column', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 31,
|
||||||
|
column: 28,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual(['tb', '.', 'c']);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Insert into spec column', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 33,
|
||||||
|
column: 21,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select order by', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 35,
|
||||||
|
column: 27,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Select group by', () => {
|
||||||
|
const pos: CaretPosition = {
|
||||||
|
lineNumber: 37,
|
||||||
|
column: 27,
|
||||||
|
};
|
||||||
|
const syntaxes = parser.getSuggestionAtCaretPosition(
|
||||||
|
commentOtherLine(syntaxSql, pos.lineNumber),
|
||||||
|
pos
|
||||||
|
)?.syntax;
|
||||||
|
const suggestion = syntaxes?.find(
|
||||||
|
(syn) => syn.syntaxContextType === SyntaxContextType.COLUMN
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(suggestion).not.toBeUndefined();
|
||||||
|
expect(suggestion?.wordRanges.map((token) => token.text)).toEqual([]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user