feat(flink): update createTable grammar
This commit is contained in:
parent
1b9efdccd5
commit
d1259b46a0
@ -22,7 +22,7 @@ emptyStatement
|
|||||||
;
|
;
|
||||||
|
|
||||||
ddlStatement
|
ddlStatement
|
||||||
: createTable | createDatabase | createView | createFunction
|
: createTable | createDatabase | createView | createFunction | createCatalog
|
||||||
| alterTable | alterDatabase | alterFunction
|
| alterTable | alterDatabase | alterFunction
|
||||||
| dropTable | dropDatabase | dropView | dropFunction
|
| dropTable | dropDatabase | dropView | dropFunction
|
||||||
;
|
;
|
||||||
@ -38,13 +38,16 @@ createTable
|
|||||||
: CREATE TABLE uid
|
: CREATE TABLE uid
|
||||||
LR_BRACKET
|
LR_BRACKET
|
||||||
columnOptionDefinition (COMMA columnOptionDefinition)*
|
columnOptionDefinition (COMMA columnOptionDefinition)*
|
||||||
|
watermarkDefinition?
|
||||||
RR_BRACKET
|
RR_BRACKET
|
||||||
|
commentSpec?
|
||||||
partitionDefinition?
|
partitionDefinition?
|
||||||
withOption
|
withOption
|
||||||
|
likeDefinition?
|
||||||
;
|
;
|
||||||
|
|
||||||
columnOptionDefinition
|
columnOptionDefinition
|
||||||
: columnName columnType
|
: columnName columnType lengthOneDimension?
|
||||||
;
|
;
|
||||||
|
|
||||||
columnName
|
columnName
|
||||||
@ -59,28 +62,60 @@ columnType
|
|||||||
| BOOLEAN | RAW | NULL)
|
| BOOLEAN | RAW | NULL)
|
||||||
;
|
;
|
||||||
|
|
||||||
|
lengthOneDimension
|
||||||
|
: '(' decimalLiteral ')'
|
||||||
|
;
|
||||||
|
|
||||||
|
commentSpec
|
||||||
|
: COMMENT STRING_LITERAL
|
||||||
|
;
|
||||||
|
|
||||||
|
watermarkDefinition
|
||||||
|
: WATERMARK FOR expression AS expression
|
||||||
|
;
|
||||||
|
|
||||||
partitionDefinition
|
partitionDefinition
|
||||||
: PARTITIONED BY partitionColumnDefinition
|
: PARTITIONED BY transformList
|
||||||
;
|
;
|
||||||
|
|
||||||
partitionColumnDefinition
|
transformList
|
||||||
: partitionColumnName (COMMA partitionColumnName)*
|
: '(' transform (',' transform)* ')'
|
||||||
;
|
;
|
||||||
|
|
||||||
partitionColumnName
|
transform
|
||||||
: ID
|
: qualifiedName #identityTransform
|
||||||
|
| transformName=identifier
|
||||||
|
'(' transformArgument (',' transformArgument)* ')' #applyTransform
|
||||||
|
;
|
||||||
|
|
||||||
|
transformArgument
|
||||||
|
: qualifiedName
|
||||||
|
| constant
|
||||||
|
;
|
||||||
|
|
||||||
|
likeDefinition
|
||||||
|
: LIKE identifier likeOption
|
||||||
|
;
|
||||||
|
|
||||||
|
likeOption
|
||||||
|
: (INCLUDING | EXCLUDING) (ALL | CONSTRAINTS)
|
||||||
|
| (INCLUDING | EXCLUDING) (GENERATED | OPTIONS)
|
||||||
|
;
|
||||||
|
|
||||||
|
createCatalog
|
||||||
|
: CREATE CATALOG uid withOption
|
||||||
;
|
;
|
||||||
|
|
||||||
createDatabase
|
createDatabase
|
||||||
: CREATE DATABASE ifNotExists? uid withOption
|
: CREATE DATABASE ifNotExists? uid commentSpec? withOption
|
||||||
;
|
;
|
||||||
|
|
||||||
createView
|
createView
|
||||||
: CREATE TEMPORARY? VIEW ifNotExists? uid AS selectStatement
|
: CREATE TEMPORARY? VIEW ifNotExists? uid (columnName (',' columnName)*)? commentSpec AS queryStatement
|
||||||
;
|
;
|
||||||
|
|
||||||
createFunction
|
createFunction
|
||||||
:
|
: CREATE (TEMPORARY|TEMPORARY SYSTEM) FUNCTION ifNotExists? uid AS identifier (LANGUAGE identifier)?
|
||||||
;
|
;
|
||||||
|
|
||||||
// Alter statements
|
// Alter statements
|
||||||
@ -346,6 +381,10 @@ dereferenceDefinition
|
|||||||
|
|
||||||
// base common
|
// base common
|
||||||
|
|
||||||
|
qualifiedName
|
||||||
|
: identifier ('.' identifier)*
|
||||||
|
;
|
||||||
|
|
||||||
interval
|
interval
|
||||||
: INTERVAL (errorCapturingMultiUnitsInterval | errorCapturingUnitToUnitInterval)?
|
: INTERVAL (errorCapturingMultiUnitsInterval | errorCapturingUnitToUnitInterval)?
|
||||||
;
|
;
|
||||||
@ -422,9 +461,7 @@ uid
|
|||||||
;
|
;
|
||||||
|
|
||||||
withOption
|
withOption
|
||||||
: WITH LR_BRACKET
|
: WITH tablePropertyList
|
||||||
keyValueDefinition (COMMA keyValueDefinition)*
|
|
||||||
RR_BRACKET
|
|
||||||
;
|
;
|
||||||
|
|
||||||
ifNotExists
|
ifNotExists
|
||||||
@ -437,6 +474,26 @@ keyValueDefinition
|
|||||||
: STRING_LITERAL EQUAL_SYMBOL STRING_LITERAL
|
: STRING_LITERAL EQUAL_SYMBOL STRING_LITERAL
|
||||||
;
|
;
|
||||||
|
|
||||||
|
tablePropertyList
|
||||||
|
: '(' tableProperty (',' tableProperty)* ')'
|
||||||
|
;
|
||||||
|
|
||||||
|
tableProperty
|
||||||
|
: key=tablePropertyKey (EQUAL_SYMBOL? value=tablePropertyValue)?
|
||||||
|
;
|
||||||
|
|
||||||
|
tablePropertyKey
|
||||||
|
: identifier ('.' identifier)*
|
||||||
|
| STRING_LITERAL
|
||||||
|
;
|
||||||
|
|
||||||
|
tablePropertyValue
|
||||||
|
: DIG_LITERAL
|
||||||
|
| REAL_LITERAL
|
||||||
|
| booleanLiteral
|
||||||
|
| STRING_LITERAL
|
||||||
|
;
|
||||||
|
|
||||||
logicalOperator
|
logicalOperator
|
||||||
: AND | '&' '&' | OR | '|' '|'
|
: AND | '&' '&' | OR | '|' '|'
|
||||||
;
|
;
|
||||||
@ -744,21 +801,15 @@ PAST: 'PAST';
|
|||||||
PATTERN: 'PATTERN';
|
PATTERN: 'PATTERN';
|
||||||
WITHIN: 'WITHIN';
|
WITHIN: 'WITHIN';
|
||||||
DEFINE: 'DEFINE';
|
DEFINE: 'DEFINE';
|
||||||
BIGINT_LITERAL: 'BIGINT_LITERAL';
|
|
||||||
SMALLINT_LITERAL: 'SMALLINT_LITERAL';
|
|
||||||
TINYINT_LITERAL: 'TINYINT_LITERAL';
|
|
||||||
INTEGER_VALUE: 'INTEGER_VALUE';
|
|
||||||
DECIMAL_VALUE: 'DECIMAL_VALUE';
|
|
||||||
DOUBLE_LITERAL: 'DOUBLE_LITERAL';
|
|
||||||
BIGDECIMAL_LITERAL: 'BIGDECIMAL_LITERAL';
|
|
||||||
IDENTIFIER: 'IDENTIFIER';
|
|
||||||
BACKQUOTED_IDENTIFIER: 'BACKQUOTED_IDENTIFIER';
|
|
||||||
SIMPLE_COMMENT: 'SIMPLE_COMMENT';
|
|
||||||
BRACKETED_EMPTY_COMMENT: 'BRACKETED_EMPTY_COMMENT';
|
|
||||||
BRACKETED_COMMENT: 'BRACKETED_COMMENT';
|
|
||||||
WS: 'WS';
|
WS: 'WS';
|
||||||
UNRECOGNIZED: 'UNRECOGNIZED';
|
|
||||||
SYSTEM: 'SYSTEM';
|
SYSTEM: 'SYSTEM';
|
||||||
|
INCLUDING: 'INCLUDING';
|
||||||
|
EXCLUDING: 'EXCLUDING';
|
||||||
|
CONSTRAINTS: 'CONSTRAINTS';
|
||||||
|
OVERWRITING: 'OVERWRITING';
|
||||||
|
GENERATED: 'GENERATED';
|
||||||
|
CATALOG: 'CATALOG';
|
||||||
|
LANGUAGE: 'LANGUAGE';
|
||||||
|
|
||||||
|
|
||||||
// DATA TYPE Keywords
|
// DATA TYPE Keywords
|
||||||
|
Loading…
Reference in New Issue
Block a user