This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.1 by this push:
new 3ff67350d02 [opt](Nereids) support all syntax to avoid fallback in
multi-statement query (#41811)
3ff67350d02 is described below
commit 3ff67350d02c8fa394bdc98567ea992703688fc5
Author: morrySnow <[email protected]>
AuthorDate: Thu Oct 17 12:42:01 2024 +0800
[opt](Nereids) support all syntax to avoid fallback in multi-statement
query (#41811)
---
.../antlr4/org/apache/doris/nereids/DorisLexer.g4 | 10 +-
.../antlr4/org/apache/doris/nereids/DorisParser.g4 | 935 ++++++++++++++++++---
.../doris/nereids/parser/LogicalPlanBuilder.java | 58 +-
.../java/org/apache/doris/qe/StmtExecutor.java | 4 +-
4 files changed, 857 insertions(+), 150 deletions(-)
diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4
b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4
index fb6190ec1f8..842ad26c02c 100644
--- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4
+++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisLexer.g4
@@ -64,6 +64,7 @@ LEFT_PAREN: '(';
RIGHT_PAREN: ')';
COMMA: ',';
DOT: '.';
+DOTDOTDOT: '...';
LEFT_BRACKET: '[';
RIGHT_BRACKET: ']';
LEFT_BRACE: '{';
@@ -77,6 +78,7 @@ RIGHT_BRACE: '}';
//--DORIS-KEYWORD-LIST-START
ACCOUNT_LOCK: 'ACCOUNT_LOCK';
ACCOUNT_UNLOCK: 'ACCOUNT_UNLOCK';
+ACTIONS: 'ACTIONS';
ADD: 'ADD';
ADDDATE:'ADDDATE';
ADMIN: 'ADMIN';
@@ -151,6 +153,7 @@ COMMITTED: 'COMMITTED';
COMPACT: 'COMPACT';
COMPLETE: 'COMPLETE';
COMPRESS_TYPE: 'COMPRESS_TYPE';
+CONDITIONS: 'CONDITIONS';
CONFIG: 'CONFIG';
CONNECTION: 'CONNECTION';
CONNECTION_ID: 'CONNECTION_ID';
@@ -158,7 +161,7 @@ CONSISTENT: 'CONSISTENT';
CONSTRAINT: 'CONSTRAINT';
CONSTRAINTS: 'CONSTRAINTS';
CONVERT: 'CONVERT';
-CONVERT_LSC: 'CONVERT_LSC';
+CONVERT_LSC: 'CONVERT_LIGHT_SCHEMA_CHANGE_PROCESS';
COPY: 'COPY';
COUNT: 'COUNT';
CREATE: 'CREATE';
@@ -202,6 +205,7 @@ DEMAND: 'DEMAND';
DESC: 'DESC';
DESCRIBE: 'DESCRIBE';
DIAGNOSE: 'DIAGNOSE';
+DIAGNOSIS: 'DIAGNOSIS';
DISK: 'DISK';
DISTINCT: 'DISTINCT';
DISTINCTPC: 'DISTINCTPC';
@@ -469,6 +473,7 @@ SERIALIZABLE: 'SERIALIZABLE';
SESSION: 'SESSION';
SET: 'SET';
SETS: 'SETS';
+SET_SESSION_VARIABLE: 'SET_SESSION_VARIABLE';
SHAPE: 'SHAPE';
SHOW: 'SHOW';
SIGNED: 'SIGNED';
@@ -530,6 +535,7 @@ UNINSTALL: 'UNINSTALL';
UNION: 'UNION';
UNIQUE: 'UNIQUE';
UNLOCK: 'UNLOCK';
+UNSET: 'UNSET';
UNSIGNED: 'UNSIGNED';
UP: 'UP';
UPDATE: 'UPDATE';
@@ -539,11 +545,13 @@ USING: 'USING';
VALUE: 'VALUE';
VALUES: 'VALUES';
VARCHAR: 'VARCHAR';
+VARIABLE: 'VARIABLE';
VARIABLES: 'VARIABLES';
VARIANT: 'VARIANT';
VERBOSE: 'VERBOSE';
VERSION: 'VERSION';
VIEW: 'VIEW';
+VIEWS: 'VIEWS';
WARM: 'WARM';
WARNINGS: 'WARNINGS';
WEEK: 'WEEK';
diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
index 5b75deca198..ad40e903560 100644
--- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
+++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
@@ -43,32 +43,74 @@ statement
;
statementBase
- : explain? query outFileClause?
#statementDefault
- | CREATE ROW POLICY (IF NOT EXISTS)? name=identifier
- ON table=multipartIdentifier
- AS type=(RESTRICTIVE | PERMISSIVE)
- TO (user=userIdentify | ROLE roleName=identifier)
- USING LEFT_PAREN booleanExpression RIGHT_PAREN
#createRowPolicy
- | CREATE (EXTERNAL)? TABLE (IF NOT EXISTS)? name=multipartIdentifier
- ((ctasCols=identifierList)? | (LEFT_PAREN columnDefs (COMMA
indexDefs)? COMMA? RIGHT_PAREN))
- (ENGINE EQ engine=identifier)?
- ((AGGREGATE | UNIQUE | DUPLICATE) KEY keys=identifierList (CLUSTER BY
clusterKeys=identifierList)?)?
+ : explain? query outFileClause? #statementDefault
+ | supportedDmlStatement #supportedDmlStatementAlias
+ | supportedCreateStatement #supportedCreateStatementAlias
+ | supportedAlterStatement #supportedAlterStatementAlias
+ | materializedViewStatement #materializedViewStatementAlias
+ | constraintStatement #constraintStatementAlias
+ | unsupportedStatement #unsupported
+ ;
+
+unsupportedStatement
+ : unsupportedSetStatement
+ | unsupoortedUnsetStatement
+ | unsupportedUseStatement
+ | unsupportedDmlStatement
+ | unsupportedKillStatement
+ | unsupportedDescribeStatement
+ | unsupportedCreateStatement
+ | unsupportedDropStatement
+ | unsupportedStatsStatement
+ | unsupportedAlterStatement
+ | unsupportedGrantRevokeStatement
+ | unsupportedAdminStatement
+ | unsupportedTransactionStatement
+ | unsupportedRecoverStatement
+ | unsupportedCancelStatement
+ | unsupportedJobStatement
+ | unsupportedCleanStatement
+ | unsupportedRefreshStatement
+ | unsupportedLoadStatement
+ | unsupportedShowStatement
+ | unsupportedOtherStatement
+ ;
+
+materializedViewStatement
+ : CREATE MATERIALIZED VIEW (IF NOT EXISTS)? mvName=multipartIdentifier
+ (LEFT_PAREN cols=simpleColumnDefs RIGHT_PAREN)? buildMode?
+ (REFRESH refreshMethod? refreshTrigger?)?
+ ((DUPLICATE)? KEY keys=identifierList)?
(COMMENT STRING_LITERAL)?
- (partition=partitionTable)?
- (DISTRIBUTED BY (HASH hashKeys=identifierList | RANDOM) (BUCKETS
(INTEGER_VALUE | autoBucket=AUTO))?)?
- (ROLLUP LEFT_PAREN rollupDefs RIGHT_PAREN)?
- properties=propertyClause?
- (BROKER extProperties=propertyClause)?
- (AS query)?
#createTable
- | CREATE (OR REPLACE)? VIEW (IF NOT EXISTS)? name=multipartIdentifier
- (LEFT_PAREN cols=simpleColumnDefs RIGHT_PAREN)?
- (COMMENT STRING_LITERAL)? AS query
#createView
- | ALTER VIEW name=multipartIdentifier (LEFT_PAREN cols=simpleColumnDefs
RIGHT_PAREN)?
- AS query
#alterView
- | CREATE (EXTERNAL)? TABLE (IF NOT EXISTS)? name=multipartIdentifier
- LIKE existedTable=multipartIdentifier
- (WITH ROLLUP (rollupNames=identifierList)?)? #createTableLike
- | explain? cte? INSERT (INTO | OVERWRITE TABLE)
+ (PARTITION BY LEFT_PAREN mvPartition RIGHT_PAREN)?
+ (DISTRIBUTED BY (HASH hashKeys=identifierList | RANDOM)
+ (BUCKETS (INTEGER_VALUE | AUTO))?)?
+ propertyClause?
+ AS query
#createMTMV
+ | REFRESH MATERIALIZED VIEW mvName=multipartIdentifier (partitionSpec |
COMPLETE | AUTO) #refreshMTMV
+ | ALTER MATERIALIZED VIEW mvName=multipartIdentifier ((RENAME
newName=identifier)
+ | (REFRESH (refreshMethod | refreshTrigger | refreshMethod
refreshTrigger))
+ | REPLACE WITH MATERIALIZED VIEW newName=identifier propertyClause?
+ | (SET LEFT_PAREN fileProperties=propertyItemList RIGHT_PAREN))
#alterMTMV
+ | DROP MATERIALIZED VIEW (IF EXISTS)? mvName=multipartIdentifier
+ (ON tableName=multipartIdentifier)?
#dropMTMV
+ | PAUSE MATERIALIZED VIEW JOB ON mvName=multipartIdentifier
#pauseMTMV
+ | RESUME MATERIALIZED VIEW JOB ON mvName=multipartIdentifier
#resumeMTMV
+ | CANCEL MATERIALIZED VIEW TASK taskId=INTEGER_VALUE ON
mvName=multipartIdentifier #cancelMTMVTask
+ | SHOW CREATE MATERIALIZED VIEW mvName=multipartIdentifier
#showCreateMTMV
+ ;
+
+constraintStatement
+ : ALTER TABLE table=multipartIdentifier
+ ADD CONSTRAINT constraintName=errorCapturingIdentifier
+ constraint
#addConstraint
+ | ALTER TABLE table=multipartIdentifier
+ DROP CONSTRAINT constraintName=errorCapturingIdentifier
#dropConstraint
+ | SHOW CONSTRAINTS FROM table=multipartIdentifier
#showConstraint
+ ;
+
+supportedDmlStatement
+ : explain? cte? INSERT (INTO | OVERWRITE TABLE)
(tableName=multipartIdentifier | DORIS_INTERNAL_TABLE_ID LEFT_PAREN
tableId=INTEGER_VALUE RIGHT_PAREN)
partitionSpec? // partition define
(WITH LABEL labelName=identifier)? cols=identifierList? // label and
columns define
@@ -82,69 +124,683 @@ statementBase
partitionSpec? tableAlias
(USING relations)?
whereClause? #delete
- | LOAD LABEL lableName=identifier
+ | LOAD LABEL lableName=multipartIdentifier
LEFT_PAREN dataDescs+=dataDesc (COMMA dataDescs+=dataDesc)* RIGHT_PAREN
(withRemoteStorageSystem)?
- (PROPERTIES LEFT_PAREN properties=propertyItemList RIGHT_PAREN)?
+ propertyClause?
(commentSpec)? #load
- | LOAD mysqlDataDesc
- (PROPERTIES LEFT_PAREN properties=propertyItemList RIGHT_PAREN)?
- (commentSpec)?
#mysqlLoad
| EXPORT TABLE tableName=multipartIdentifier
(PARTITION partition=identifierList)?
(whereClause)?
TO filePath=STRING_LITERAL
(propertyClause)?
(withRemoteStorageSystem)? #export
- | CREATE MATERIALIZED VIEW (IF NOT EXISTS)? mvName=multipartIdentifier
- (LEFT_PAREN cols=simpleColumnDefs RIGHT_PAREN)? buildMode?
- (REFRESH refreshMethod? refreshTrigger?)?
- ((DUPLICATE)? KEY keys=identifierList)?
+ ;
+
+supportedCreateStatement
+ : CREATE (EXTERNAL)? TABLE (IF NOT EXISTS)? name=multipartIdentifier
+ ((ctasCols=identifierList)? | (LEFT_PAREN columnDefs (COMMA
indexDefs)? COMMA? RIGHT_PAREN))
+ (ENGINE EQ engine=identifier)?
+ ((AGGREGATE | UNIQUE | DUPLICATE) KEY keys=identifierList
+ (CLUSTER BY clusterKeys=identifierList)?)?
(COMMENT STRING_LITERAL)?
- (PARTITION BY LEFT_PAREN mvPartition RIGHT_PAREN)?
- (DISTRIBUTED BY (HASH hashKeys=identifierList | RANDOM) (BUCKETS
(INTEGER_VALUE | AUTO))?)?
- propertyClause?
- AS query
#createMTMV
- | REFRESH MATERIALIZED VIEW mvName=multipartIdentifier (partitionSpec |
COMPLETE | AUTO) #refreshMTMV
- | ALTER MATERIALIZED VIEW mvName=multipartIdentifier ((RENAME
newName=identifier)
- | (REFRESH (refreshMethod | refreshTrigger | refreshMethod
refreshTrigger))
- | REPLACE WITH MATERIALIZED VIEW newName=identifier propertyClause?
- | (SET LEFT_PAREN fileProperties=propertyItemList RIGHT_PAREN))
#alterMTMV
- | DROP MATERIALIZED VIEW (IF EXISTS)? mvName=multipartIdentifier
#dropMTMV
- | PAUSE MATERIALIZED VIEW JOB ON mvName=multipartIdentifier #pauseMTMV
- | RESUME MATERIALIZED VIEW JOB ON mvName=multipartIdentifier
#resumeMTMV
- | CANCEL MATERIALIZED VIEW TASK taskId=INTEGER_VALUE ON
mvName=multipartIdentifier #cancelMTMVTask
- | SHOW CREATE MATERIALIZED VIEW mvName=multipartIdentifier #showCreateMTMV
- | ALTER TABLE table=multipartIdentifier
- ADD CONSTRAINT constraintName=errorCapturingIdentifier
- constraint
#addConstraint
- | ALTER TABLE table=multipartIdentifier
- DROP CONSTRAINT constraintName=errorCapturingIdentifier
#dropConstraint
- | SHOW CONSTRAINTS FROM table=multipartIdentifier
#showConstraint
- | unsupportedStatement
#unsupported
+ (partition=partitionTable)?
+ (DISTRIBUTED BY (HASH hashKeys=identifierList | RANDOM)
+ (BUCKETS (INTEGER_VALUE | autoBucket=AUTO))?)?
+ (ROLLUP LEFT_PAREN rollupDefs RIGHT_PAREN)?
+ properties=propertyClause?
+ (BROKER extProperties=propertyClause)?
+ (AS query)?
#createTable
+ | CREATE (OR REPLACE)? VIEW (IF NOT EXISTS)? name=multipartIdentifier
+ (LEFT_PAREN cols=simpleColumnDefs RIGHT_PAREN)?
+ (COMMENT STRING_LITERAL)? AS query
#createView
+ | CREATE (EXTERNAL)? TABLE (IF NOT EXISTS)? name=multipartIdentifier
+ LIKE existedTable=multipartIdentifier
+ (WITH ROLLUP (rollupNames=identifierList)?)?
#createTableLike
+ | CREATE ROW POLICY (IF NOT EXISTS)? name=identifier
+ ON table=multipartIdentifier
+ AS type=(RESTRICTIVE | PERMISSIVE)
+ TO (user=userIdentify | ROLE roleName=identifier)
+ USING LEFT_PAREN booleanExpression RIGHT_PAREN
#createRowPolicy
;
-unsupportedStatement
- : SET identifier AS DEFAULT STORAGE VAULT
#setDefaultStorageVault
- | SET PROPERTY (FOR user=identifierOrText)? propertyItemList
#setUserProperties
- | SET (GLOBAL | LOCAL | SESSION)? identifier EQ (expression | DEFAULT)
#setSystemVariableWithType
- | SET variable
#setSystemVariableWithoutType
- | SET (CHAR SET | CHARSET) (charsetName=identifierOrText | DEFAULT)
#setCharset
- | SET NAMES EQ expression
#setNames
+supportedAlterStatement
+ : ALTER VIEW name=multipartIdentifier (LEFT_PAREN cols=simpleColumnDefs
RIGHT_PAREN)?
+ AS query
#alterView
+ ;
+
+unsupportedOtherStatement
+ : HELP mark=identifierOrText
#help
+ | INSTALL PLUGIN FROM source=identifierOrText properties=propertyClause?
#installPlugin
+ | UNINSTALL PLUGIN name=identifierOrText
#uninstallPlugin
+ | LOCK TABLES (lockTable (COMMA lockTable)*)?
#lockTables
+ | UNLOCK TABLES
#unlockTables
+ | BACKUP SNAPSHOT label=multipartIdentifier TO repo=identifier
+ ((ON | EXCLUDE) LEFT_PAREN baseTableRef (COMMA baseTableRef)*
RIGHT_PAREN)?
+ properties=propertyClause?
#backup
+ | RESTORE SNAPSHOT label=multipartIdentifier FROM repo=identifier
+ ((ON | EXCLUDE) LEFT_PAREN baseTableRef (COMMA baseTableRef)*
RIGHT_PAREN)?
+ properties=propertyClause?
#restore
+ | START TRANSACTION (WITH CONSISTENT SNAPSHOT)?
#unsupportedStartTransaction
+ ;
+
+lockTable
+ : name=multipartIdentifier (AS alias=identifierOrText)?
+ (READ (LOCAL)? | (LOW_PRIORITY)? WRITE)
+ ;
+
+unsupportedShowStatement
+ : SHOW SQL_BLOCK_RULE (FOR ruleName=identifier)?
#showSqlBlockRule
+ | SHOW ROW POLICY (FOR (userIdentify | (ROLE role=identifier)))?
#showRowPolicy
+ | SHOW STORAGE POLICY (USING (FOR policy=identifierOrText)?)?
#showStoragePolicy
+ | SHOW CREATE REPOSITORY FOR identifier
#showCreateRepository
+ | SHOW WHITELIST
#showWhitelist
+ | SHOW (GLOBAL | SESSION | LOCAL)? VARIABLES wildWhere?
#showVariables
+ | SHOW OPEN TABLES ((FROM | IN) database=multipartIdentifier)? wildWhere?
#showOpenTables
+ | SHOW TABLE STATUS ((FROM | IN) database=multipartIdentifier)? wildWhere?
#showTableStatus
+ | SHOW FULL? TABLES ((FROM | IN) database=multipartIdentifier)? wildWhere?
#showTables
+ | SHOW FULL? VIEWS ((FROM | IN) database=multipartIdentifier)? wildWhere?
#showViews
+ | SHOW TABLE tableId=INTEGER_VALUE
#showTableId
+ | SHOW FULL? PROCESSLIST
#showProcessList
+ | SHOW (GLOBAL | SESSION | LOCAL)? STATUS wildWhere?
#showStatus
+ | SHOW FULL? TRIGGERS ((FROM | IN) database=multipartIdentifier)?
wildWhere? #showTriggers
+ | SHOW EVENTS ((FROM | IN) database=multipartIdentifier)? wildWhere?
#showEvents
+ | SHOW PLUGINS
#showPlugins
+ | SHOW STORAGE? ENGINES
#showStorageEngines
+ | SHOW AUTHORS
#showAuthors
+ | SHOW BRIEF? CREATE TABLE name=multipartIdentifier
#showCreateTable
+ | SHOW CREATE VIEW name=multipartIdentifier
#showCreateView
+ | SHOW CREATE MATERIALIZED VIEW name=multipartIdentifier
#showMaterializedView
+ | SHOW CREATE (DATABASE | SCHEMA) name=multipartIdentifier
#showCreateDatabase
+ | SHOW CREATE CATALOG name=identifier
#showCreateCatalog
+ | SHOW CREATE (GLOBAL | SESSION | LOCAL)? FUNCTION functionIdentifier
+ LEFT_PAREN functionArguments? RIGHT_PAREN
+ ((FROM | IN) database=multipartIdentifier)?
#showCreateFunction
+ | SHOW (DATABASES | SCHEMAS) (FROM catalog=identifier)? wildWhere?
#showDatabases
+ | SHOW DATABASE databaseId=INTEGER_VALUE
#showDatabaseId
+ | SHOW DATA TYPES
#showDataTypes
+ | SHOW CATALOGS wildWhere?
#showCatalogs
+ | SHOW CATALOG name=identifier
#showCatalog
+ | SHOW DYNAMIC PARTITION TABLES ((FROM | IN)
database=multipartIdentifier)? #showDynamicPartition
+ | SHOW FULL? (COLUMNS | FIELDS) (FROM | IN) tableName=multipartIdentifier
+ ((FROM | IN) database=multipartIdentifier)? wildWhere?
#showColumns
+ | SHOW COLLATION wildWhere?
#showCollation
+ | SHOW ((CHAR SET) | CHARSET) wildWhere?
#showCharset
+ | SHOW PROC path=STRING_LITERAL
#showProc
+ | SHOW COUNT LEFT_PAREN ASTERISK RIGHT_PAREN (WARNINGS | ERRORS)
#showWaringErrorCount
+ | SHOW (WARNINGS | ERRORS) limitClause?
#showWaringErrors
+ | SHOW LOAD WARNINGS ((((FROM | IN) database=multipartIdentifier)?
+ wildWhere? limitClause?) | (ON url=STRING_LITERAL))
#showLoadWarings
+ | SHOW STREAM? LOAD ((FROM | IN) database=multipartIdentifier)? wildWhere?
+ sortClause? limitClause?
#showLoad
+ | SHOW EXPORT ((FROM | IN) database=multipartIdentifier)? wildWhere?
+ sortClause? limitClause?
#showExport
+ | SHOW DELETE ((FROM | IN) database=multipartIdentifier)?
#showDelete
+ | SHOW ALTER TABLE (ROLLUP | (MATERIALIZED VIEW) | COLUMN)
+ ((FROM | IN) database=multipartIdentifier)? wildWhere?
+ sortClause? limitClause?
#showAlterTable
+ | SHOW DATA SKEW FROM baseTableRef
#showDataSkew
+ | SHOW DATA (FROM tableName=multipartIdentifier)? sortClause?
propertyClause? #showData
+ | SHOW TEMPORARY? PARTITIONS FROM tableName=multipartIdentifier
+ wildWhere? sortClause? limitClause?
#showPartitions
+ | SHOW PARTITION partitionId=INTEGER_VALUE
#showPartitionId
+ | SHOW TABLET tabletId=INTEGER_VALUE
#showTabletId
+ | SHOW TABLETS BELONG
+ tabletIds+=INTEGER_VALUE (COMMA tabletIds+=INTEGER_VALUE)*
#showTabletBelong
+ | SHOW TABLETS FROM tableName=multipartIdentifier partitionSpec?
+ wildWhere? sortClause? limitClause?
#showTabletsFromTable
+ | SHOW PROPERTY (FOR user=identifierOrText)? wildWhere?
#showUserProperties
+ | SHOW ALL PROPERTIES wildWhere?
#showAllProperties
+ | SHOW BACKUP ((FROM | IN) database=multipartIdentifier)? wildWhere?
#showBackup
+ | SHOW BRIEF? RESTORE ((FROM | IN) database=multipartIdentifier)?
wildWhere? #showRestore
+ | SHOW BROKER
#showBroker
+ | SHOW RESOURCES wildWhere? sortClause? limitClause?
#showResources
+ | SHOW WORKLOAD GROUPS wildWhere?
#showWorkloadGroups
+ | SHOW BACKENDS
#showBackends
+ | SHOW TRASH (ON backend=STRING_LITERAL)?
#showTrash
+ | SHOW FRONTENDS name=identifier?
#showFrontends
+ | SHOW REPOSITORIES
#showRepositories
+ | SHOW SNAPSHOT ON repo=identifier wildWhere?
#showSnapshot
+ | SHOW ALL? GRANTS
#showGrants
+ | SHOW GRANTS FOR userIdentify
#showGrantsForUser
+ | SHOW ROLES
#showRoles
+ | SHOW PRIVILEGES
#showPrivileges
+ | SHOW FULL? BUILTIN? FUNCTIONS
+ ((FROM | IN) database=multipartIdentifier)? wildWhere?
#showFunctions
+ | SHOW GLOBAL FULL? FUNCTIONS wildWhere?
#showGlobalFunctions
+ | SHOW TYPECAST ((FROM | IN) database=multipartIdentifier)?
#showTypeCast
+ | SHOW FILE ((FROM | IN) database=multipartIdentifier)?
#showSmallFiles
+ | SHOW (KEY | KEYS | INDEX | INDEXES)
+ (FROM |IN) tableName=multipartIdentifier
+ ((FROM | IN) database=multipartIdentifier)?
#showIndex
+ | SHOW VIEW
+ (FROM |IN) tableName=multipartIdentifier
+ ((FROM | IN) database=multipartIdentifier)?
#showView
+ | SHOW TRANSACTION ((FROM | IN) database=multipartIdentifier)? wildWhere?
#showTransaction
+ | SHOW QUERY PROFILE queryIdPath=STRING_LITERAL
#showQueryProfile
+ | SHOW LOAD PROFILE loadIdPath=STRING_LITERAL
#showLoadProfile
+ | SHOW CACHE HOTSPOT tablePath=STRING_LITERAL
#showCacheHotSpot
+ | SHOW ENCRYPTKEYS ((FROM | IN) database=multipartIdentifier)? wildWhere?
#showEncryptKeys
+ | SHOW SYNC JOB ((FROM | IN) database=multipartIdentifier)?
#showSyncJob
+ | SHOW TABLE CREATION ((FROM | IN) database=multipartIdentifier)?
wildWhere? #showTableCreation
+ | SHOW LAST INSERT
#showLastInsert
+ | SHOW CREATE MATERIALIZED VIEW mvName=identifier
+ ON tableName=multipartIdentifier
#showCreateMaterializedView
+ | SHOW CATALOG RECYCLE BIN wildWhere?
#showCatalogRecycleBin
+ | SHOW QUERY STATS ((FOR database=identifier)
+ | (FROM tableName=multipartIdentifier (ALL VERBOSE?)?))?
#showQueryStats
+ | SHOW BUILD INDEX ((FROM | IN) database=multipartIdentifier)?
+ wildWhere? sortClause? limitClause?
#showBuildIndex
+ | SHOW CONVERT_LSC ((FROM | IN) database=multipartIdentifier)?
#showConvertLsc
+ | SHOW REPLICA STATUS FROM baseTableRef wildWhere?
#showReplicaStatus
+ | SHOW REPLICA DISTRIBUTION FROM baseTableRef
#showREplicaDistribution
+ | SHOW TABLET STORAGE FORMAT VERBOSE?
#showTabletStorageFormat
+ | SHOW TABLET DIAGNOSIS tabletId=INTEGER_VALUE
#showDiagnoseTablet
+ | SHOW COPY ((FROM | IN) database=multipartIdentifier)?
+ whereClause? sortClause? limitClause?
#showCopy
+ | SHOW WARM UP JOB wildWhere?
#showWarmUpJob
+ ;
+
+unsupportedLoadStatement
+ : LOAD mysqlDataDesc
+ (PROPERTIES LEFT_PAREN properties=propertyItemList RIGHT_PAREN)?
+ (commentSpec)?
#mysqlLoad
+ | CREATE SYNC label=multipartIdentifier
+ LEFT_PAREN channelDescriptions RIGHT_PAREN
+ FROM BINLOG LEFT_PAREN propertyItemList RIGHT_PAREN
+ properties=propertyClause?
#createDataSyncJob
+ | STOP SYNC JOB name=multipartIdentifier
#stopDataSyncJob
+ | RESUME SYNC JOB name=multipartIdentifier
#resumeDataSyncJob
+ | PAUSE SYNC JOB name=multipartIdentifier
#pauseDataSyncJob
+ | CREATE ROUTINE LOAD label=multipartIdentifier (ON table=identifier)?
+ (WITH (APPEND | DELETE | MERGE))?
+ (loadProperty (COMMA loadProperty)*)? propertyClause? FROM
type=identifier
+ LEFT_PAREN customProperties=propertyItemList RIGHT_PAREN
+ commentSpec?
#createRoutineLoadJob
+ | PAUSE ROUTINE LOAD FOR label=multipartIdentifier
#pauseRoutineLoad
+ | PAUSE ALL ROUTINE LOAD
#pauseAllRoutineLoad
+ | RESUME ROUTINE LOAD FOR label=multipartIdentifier
#resumeRoutineLoad
+ | RESUME ALL ROUTINE LOAD
#resumeAllRoutineLoad
+ | STOP ROUTINE LOAD FOR label=multipartIdentifier
#stopRoutineLoad
+ | SHOW ALL? ROUTINE LOAD ((FOR label=multipartIdentifier) | wildWhere?)
#showRoutineLoad
+ | SHOW ROUTINE LOAD TASK ((FROM | IN) database=identifier)? wildWhere?
#showRoutineLoadTask
+ | SHOW ALL? CREATE ROUTINE LOAD FOR label=multipartIdentifier
#showCreateRoutineLoad
+ | SHOW CREATE LOAD FOR label=multipartIdentifier
#showCreateLoad
+ | SYNC
#sync
+ | importSequenceStatement
#importSequenceStatementAlias
+ | importPrecedingFilterStatement
#importPrecedingFilterStatementAlias
+ | importWhereStatement
#importWhereStatementAlias
+ | importDeleteOnStatement
#importDeleteOnStatementAlias
+ | importColumnsStatement
#importColumnsStatementAlias
+ ;
+
+loadProperty
+ : COLUMNS TERMINATED BY STRING_LITERAL
#separator
+ | importColumnsStatement
#importColumns
+ | importPrecedingFilterStatement
#importPrecedingFilter
+ | importWhereStatement
#importWhere
+ | importDeleteOnStatement
#importDeleteOn
+ | importSequenceStatement
#importSequence
+ | partitionSpec
#importPartitions
+ ;
+
+importSequenceStatement
+ : ORDER BY identifier
+ ;
+
+importDeleteOnStatement
+ : DELETE ON booleanExpression
+ ;
+
+importWhereStatement
+ : WHERE booleanExpression
+ ;
+
+importPrecedingFilterStatement
+ : PRECEDING FILTER booleanExpression
+ ;
+
+importColumnsStatement
+ : COLUMNS LEFT_PAREN importColumnDesc (COMMA importColumnDesc)* RIGHT_PAREN
+ ;
+
+importColumnDesc
+ : name=identifier (EQ booleanExpression)?
+ | LEFT_PAREN name=identifier (EQ booleanExpression)? RIGHT_PAREN
+ ;
+
+channelDescriptions
+ : channelDescription (COMMA channelDescription)*
+ ;
+
+channelDescription
+ : FROM source=multipartIdentifier INTO destination=multipartIdentifier
+ partitionSpec? columnList=identifierList?
+ ;
+
+unsupportedRefreshStatement
+ : REFRESH TABLE name=multipartIdentifier
#refreshTable
+ | REFRESH DATABASE name=multipartIdentifier propertyClause?
#refreshDatabase
+ | REFRESH CATALOG name=identifier propertyClause?
#refreshCatalog
+ | REFRESH LDAP (ALL | (FOR user=identifierOrText))
#refreshLdap
+ ;
+
+unsupportedCleanStatement
+ : CLEAN LABEL label=identifier? (FROM | IN) database=identifier
#cleanLabel
+ | CLEAN ALL PROFILE
#cleanAllProfile
+ | CLEAN QUERY STATS ((FOR database=identifier)
+ | ((FROM | IN) table=multipartIdentifier))
#cleanQueryStats
+ | CLEAN ALL QUERY STATS
#cleanAllQueryStats
+ ;
+
+unsupportedJobStatement
+ : CREATE JOB label=multipartIdentifier ON SCHEDULE
+ (
+ (EVERY timeInterval=INTEGER_VALUE timeUnit=identifier
+ (STARTS (startTime=STRING_LITERAL | CURRENT_TIMESTAMP))?
+ (ENDS endsTime=STRING_LITERAL)?)
+ |
+ (AT (atTime=STRING_LITERAL | CURRENT_TIMESTAMP)))
+ commentSpec?
+ DO statement
#createJob
+ | PAUSE JOB wildWhere?
#pauseJob
+ | DROP JOB (IF EXISTS)? wildWhere?
#dropJob
+ | RESUME JOB wildWhere?
#resumeJob
+ | CANCEL TASK wildWhere?
#cancelJobTask
+ ;
+
+unsupportedCancelStatement
+ : CANCEL LOAD ((FROM | IN) database=identifier)? wildWhere?
#cancelLoad
+ | CANCEL EXPORT ((FROM | IN) database=identifier)? wildWhere?
#cancelExport
+ | CANCEL ALTER TABLE (ROLLUP | (MATERIALIZED VIEW) | COLUMN)
+ FROM tableName=multipartIdentifier (LEFT_PAREN jobIds+=INTEGER_VALUE
+ (COMMA jobIds+=INTEGER_VALUE)* RIGHT_PAREN)?
#cancelAlterTable
+ | CANCEL BUILD INDEX ON tableName=multipartIdentifier
+ (LEFT_PAREN jobIds+=INTEGER_VALUE
+ (COMMA jobIds+=INTEGER_VALUE)* RIGHT_PAREN)?
#cancelBuildIndex
+ | CANCEL DECOMMISSION BACKEND hostPorts+=STRING_LITERAL
+ (COMMA hostPorts+=STRING_LITERAL)*
#cancelDecommisionBackend
+ | CANCEL BACKUP ((FROM | IN) database=identifier)?
#cancelBackup
+ | CANCEL RESTORE ((FROM | IN) database=identifier)?
#cancelRestore
+ | CANCEL WARM UP JOB wildWhere?
#cancelWarmUp
+ ;
+
+unsupportedRecoverStatement
+ : RECOVER DATABASE name=identifier id=INTEGER_VALUE? (AS
alias=identifier)? #recoverDatabase
+ | RECOVER TABLE name=multipartIdentifier
+ id=INTEGER_VALUE? (AS alias=identifier)?
#recoverTable
+ | RECOVER PARTITION name=identifier id=INTEGER_VALUE? (AS
alias=identifier)?
+ FROM tableName=multipartIdentifier
#recoverPartition
+ ;
+
+unsupportedAdminStatement
+ : ADMIN SHOW REPLICA STATUS FROM baseTableRef wildWhere?
#adminShowReplicaStatus
+ | ADMIN SHOW REPLICA DISTRIBUTION FROM baseTableRef
#adminShowReplicaDistribution
+ | ADMIN SET REPLICA STATUS PROPERTIES LEFT_PAREN propertyItemList
RIGHT_PAREN #adminSetReplicaStatus
+ | ADMIN SET REPLICA VERSION PROPERTIES LEFT_PAREN propertyItemList
RIGHT_PAREN #adminSetReplicaVersion
+ | ADMIN REPAIR TABLE baseTableRef
#adminRepairTable
+ | ADMIN CANCEL REPAIR TABLE baseTableRef
#adminCancelRepairTable
+ | ADMIN COMPACT TABLE baseTableRef wildWhere?
#adminCompactTable
+ | ADMIN SET (FRONTEND | (ALL FRONTENDS)) CONFIG
+ (LEFT_PAREN propertyItemList RIGHT_PAREN)? ALL?
#adminSetFrontendConfig
+ | ADMIN CHECK tabletList properties=propertyClause?
#adminCheckTablets
+ | ADMIN REBALANCE DISK (ON LEFT_PAREN backends+=STRING_LITERAL
+ (COMMA backends+=STRING_LITERAL) RIGHT_PAREN)?
#adminRebalanceDisk
+ | ADMIN CANCEL REBALANCE DISK (ON LEFT_PAREN backends+=STRING_LITERAL
+ (COMMA backends+=STRING_LITERAL) RIGHT_PAREN)?
#adminCancelRebalanceDisk
+ | ADMIN CLEAN TRASH (ON LEFT_PAREN backends+=STRING_LITERAL
+ (COMMA backends+=STRING_LITERAL) RIGHT_PAREN)?
#adminCleanTrash
+ | ADMIN SET TABLE name=multipartIdentifier
+ PARTITION VERSION properties=propertyClause?
#adminSetPartitionVersion
+ | ADMIN DIAGNOSE TABLET tabletId=INTEGER_VALUE
#adminDiagnoseTablet
+ | ADMIN SHOW TABLET STORAGE FORMAT VERBOSE?
#adminShowTabletStorageFormat
+ | ADMIN COPY TABLET tabletId=INTEGER_VALUE properties=propertyClause?
#adminCopyTablet
+ | ADMIN SET TABLE name=multipartIdentifier STATUS
properties=propertyClause? #adminSetTableStatus
+ ;
+
+baseTableRef
+ : multipartIdentifier optScanParams? tableSnapshot? specifiedPartition?
+ tabletList? tableAlias sample? relationHint?
+ ;
+
+wildWhere
+ : LIKE STRING_LITERAL
+ | WHERE expression
+ ;
+
+unsupportedTransactionStatement
+ : BEGIN (WITH LABEL identifier?)?
#transactionBegin
+ | COMMIT WORK? (AND NO? CHAIN)? (NO? RELEASE)?
#transcationCommit
+ | ROLLBACK WORK? (AND NO? CHAIN)? (NO? RELEASE)?
#transactionRollback
+ ;
+
+unsupportedGrantRevokeStatement
+ : GRANT privilegeList ON multipartIdentifierOrAsterisk
+ TO (userIdentify | ROLE STRING_LITERAL)
#grantTablePrivilege
+ | GRANT privilegeList ON
+ (RESOURCE | WORKLOAD GROUP)
+ identifierOrTextOrAsterisk TO (userIdentify | ROLE STRING_LITERAL)
#grantResourcePrivilege
+ | GRANT roles+=STRING_LITERAL (COMMA roles+=STRING_LITERAL)* TO
userIdentify #grantRole
+ | REVOKE privilegeList ON multipartIdentifierOrAsterisk
+ FROM (userIdentify | ROLE STRING_LITERAL)
#grantTablePrivilege
+ | REVOKE privilegeList ON
+ (RESOURCE | WORKLOAD GROUP)
+ identifierOrTextOrAsterisk FROM (userIdentify | ROLE STRING_LITERAL)
#grantResourcePrivilege
+ | REVOKE roles+=STRING_LITERAL (COMMA roles+=STRING_LITERAL)* FROM
userIdentify #grantRole
+ ;
+
+privilege
+ : name=identifier columns=identifierList?
+ | ALL
+ ;
+
+privilegeList
+ : privilege (COMMA privilege)*
+ ;
+
+unsupportedAlterStatement
+ : ALTER TABLE tableName=multipartIdentifier
+ alterTableClause (COMMA alterTableClause)*
#alterTable
+ | ALTER TABLE tableName=multipartIdentifier ADD ROLLUP
+ addRollupClause (COMMA addRollupClause)*
#alterTableAddRollup
+ | ALTER TABLE tableName=multipartIdentifier DROP ROLLUP
+ dropRollupClause (COMMA dropRollupClause)*
#alterTableDropRollup
+ | ALTER SYSTEM alterSystemClause
#alterSystem
+ | ALTER DATABASE name=identifier SET (DATA |REPLICA | TRANSACTION)
+ QUOTA INTEGER_VALUE identifier?
#alterDatabaseSetQuota
+ | ALTER DATABASE name=identifier RENAME newName=identifier
#alterDatabaseRename
+ | ALTER DATABASE name=identifier SET PROPERTIES
+ LEFT_PAREN propertyItemList RIGHT_PAREN
#alterDatabaseProperties
+ | ALTER CATALOG name=identifier RENAME newName=identifier
#alterCatalogRename
+ | ALTER CATALOG name=identifier SET PROPERTIES
+ LEFT_PAREN propertyItemList RIGHT_PAREN
#alterCatalogProperties
+ | ALTER CATALOG name=identifier MODIFY COMMENT comment=STRING_LITERAL
#alterCatalogComment
+ | ALTER RESOURCE name=identifierOrText properties=propertyClause?
#alterResource
+ | ALTER COLOCATE GROUP name=multipartIdentifier
+ SET LEFT_PAREN propertyItemList RIGHT_PAREN
#alterColocateGroup
+ | ALTER WORKLOAD GROUP name=identifierOrText
+ properties=propertyClause?
#alterWorkloadGroup
+ | ALTER WORKLOAD POLICY name=identifierOrText
+ properties=propertyClause?
#alterWorkloadPolicy
+ | ALTER ROUTINE LOAD FOR name=multipartIdentifier
properties=propertyClause?
+ (FROM type=identifier LEFT_PAREN propertyItemList RIGHT_PAREN)?
#alterRoutineLoad
+ | ALTER SQL_BLOCK_RULE name=identifier properties=propertyClause?
#alterSqlBlockRule
+ | ALTER TABLE name=multipartIdentifier
+ SET LEFT_PAREN propertyItemList RIGHT_PAREN
#alterTableProperties
+ | ALTER STORAGE POLICY name=identifierOrText
+ properties=propertyClause
#alterStoragePlicy
+ | ALTER USER (IF EXISTS)? grantUserIdentify
+ passwordOption (COMMENT STRING_LITERAL)?
#alterUser
+ | ALTER ROLE role=identifier commentSpec
#alterRole
+ | ALTER REPOSITORY name=identifier properties=propertyClause?
#alterRepository
+ ;
+
+alterSystemClause
+ : ADD BACKEND hostPorts+=STRING_LITERAL (COMMA hostPorts+=STRING_LITERAL)*
+ properties=propertyClause?
#addBackendClause
+ | (DROP | DROPP) BACKEND hostPorts+=STRING_LITERAL
+ (COMMA hostPorts+=STRING_LITERAL)*
#dropBackendClause
+ | DECOMMISSION BACKEND hostPorts+=STRING_LITERAL
+ (COMMA hostPorts+=STRING_LITERAL)*
#decommissionBackendClause
+ | ADD OBSERVER hostPort=STRING_LITERAL
#addObserverClause
+ | DROP OBSERVER hostPort=STRING_LITERAL
#dropObserverClause
+ | ADD FOLLOWER hostPort=STRING_LITERAL
#addFollowerClause
+ | DROP FOLLOWER hostPort=STRING_LITERAL
#dropFollowerClause
+ | ADD BROKER name=identifierOrText hostPorts+=STRING_LITERAL
+ (COMMA hostPorts+=STRING_LITERAL)*
#addBrokerClause
+ | DROP BROKER name=identifierOrText hostPorts+=STRING_LITERAL
+ (COMMA hostPorts+=STRING_LITERAL)*
#dropBrokerClause
+ | DROP ALL BROKER name=identifierOrText
#dropAllBrokerClause
+ | SET LOAD ERRORS HUB properties=propertyClause?
#alterLoadErrorUrlClause
+ | MODIFY BACKEND hostPorts+=STRING_LITERAL
+ (COMMA hostPorts+=STRING_LITERAL)*
+ SET LEFT_PAREN propertyItemList RIGHT_PAREN
#modifyBackendClause
+ | MODIFY (FRONTEND | BACKEND) hostPort=STRING_LITERAL
+ HOSTNAME hostName=STRING_LITERAL
#modifyFrontendOrBackendHostNameClause
+ ;
+
+dropRollupClause
+ : rollupName=identifier properties=propertyClause?
+ ;
+
+addRollupClause
+ : rollupName=identifier columns=identifierList
+ (DUPLICATE KEY dupKeys=identifierList)? fromRollup?
+ properties=propertyClause?
+ ;
+
+alterTableClause
+ : ADD COLUMN columnDef columnPosition? toRollup?
properties=propertyClause? #addColumnClause
+ | ADD COLUMN LEFT_PAREN columnDef (COMMA columnDef)* RIGHT_PAREN
+ toRollup? properties=propertyClause?
#addColumnsClause
+ | DROP COLUMN name=identifier fromRollup? properties=propertyClause?
#dropColumnClause
+ | MODIFY COLUMN columnDef columnPosition? fromRollup?
+ properties=propertyClause?
#modifyColumnClause
+ | ORDER BY identifierList fromRollup? properties=propertyClause?
#reorderColumnsClause
+ | ADD TEMPORARY? (lessThanPartitionDef | fixedPartitionDef |
inPartitionDef)
+ (LEFT_PAREN partitionProperties=propertyItemList RIGHT_PAREN)?
+ (DISTRIBUTED BY (HASH hashKeys=identifierList | RANDOM)
+ (BUCKETS (INTEGER_VALUE | autoBucket=AUTO))?)?
+ properties=propertyClause?
#addPartitionClause
+ | DROP TEMPORARY? PARTITION (IF EXISTS)? partitionName=identifier FORCE?
+ (FROM INDEX indexName=identifier)?
#dropPartitionClause
+ | MODIFY TEMPORARY? PARTITION (IF EXISTS)?
+ (partitionName=identifier | partitionNames=identifierList
+ | LEFT_PAREN ASTERISK RIGHT_PAREN)
+ SET LEFT_PAREN partitionProperties=propertyItemList RIGHT_PAREN
#modifyPartitionClause
+ | REPLACE partitions=partitionSpec? WITH tempPartitions=partitionSpec?
+ FORCE? properties=propertyClause?
#replacePartitionClause
+ | REPLACE WITH TABLE name=identifier properties=propertyClause?
#replaceTableClause
+ | RENAME newName=identifier
#renameClause
+ | RENAME ROLLUP name=identifier newName=identifier
#renameRollupClause
+ | RENAME PARTITION name=identifier newName=identifier
#renamePartitionClause
+ | RENAME COLUMN name=identifier newName=identifier
#renameColumnClause
+ | ADD indexDef
#addIndexClause
+ | DROP INDEX (IF EXISTS)? name=identifier
#dropIndexClause
+ | ENABLE FEATURE name=STRING_LITERAL (WITH properties=propertyClause)?
#enableFeatureClause
+ | MODIFY DISTRIBUTION (DISTRIBUTED BY (HASH hashKeys=identifierList |
RANDOM)
+ (BUCKETS (INTEGER_VALUE | autoBucket=AUTO))?)?
#modifyDistributionClause
+ | MODIFY COMMENT comment=STRING_LITERAL
#modifyTableCommentClause
+ | MODIFY COLUMN name=identifier COMMENT comment=STRING_LITERAL
#modifyColumnCommentClause
+ | MODIFY ENGINE TO name=identifier properties=propertyClause?
#modifyEngineClause
+ | ADD TEMPORARY? PARTITIONS
+ FROM from=partitionValueList TO to=partitionValueList
+ INTERVAL INTEGER_VALUE unit=identifier? properties=propertyClause?
#alterMultiPartitionClause
+ ;
+
+columnPosition
+ : FIRST
+ | AFTER position=identifier
+ ;
+
+toRollup
+ : (TO | IN) rollup=identifier
+ ;
+
+fromRollup
+ : FROM rollup=identifier
+ ;
+
+unsupportedDropStatement
+ : DROP (DATABASE | SCHEMA) (IF EXISTS)? name=multipartIdentifier FORCE?
#dropDatabase
+ | DROP CATALOG (IF EXISTS)? name=identifier
#dropCatalog
+ | DROP (GLOBAL | SESSION | LOCAL)? FUNCTION (IF EXISTS)?
+ functionIdentifier LEFT_PAREN functionArguments? RIGHT_PAREN
#dropFunction
+ | DROP TABLE (IF EXISTS)? name=multipartIdentifier FORCE?
#dropTable
+ | DROP USER (IF EXISTS)? userIdentify
#dropUser
+ | DROP VIEW (IF EXISTS)? name=multipartIdentifier
#dropView
+ | DROP REPOSITORY name=identifier
#dropRepository
+ | DROP ROLE (IF EXISTS)? name=identifier
#dropRole
+ | DROP FILE name=STRING_LITERAL
+ ((FROM | IN) database=identifier)? properties=propertyClause
#dropFile
+ | DROP INDEX (IF EXISTS)? name=identifier ON tableName=multipartIdentifier
#dropIndex
+ | DROP RESOURCE (IF EXISTS)? name=identifierOrText
#dropResource
+ | DROP WORKLOAD GROUP (IF EXISTS)? name=identifierOrText
#dropWorkloadGroup
+ | DROP WORKLOAD POLICY (IF EXISTS)? name=identifierOrText
#dropWorkloadPolicy
+ | DROP ENCRYPTKEY (IF EXISTS)? name=multipartIdentifier
#dropEncryptkey
+ | DROP SQL_BLOCK_RULE (IF EXISTS)? identifierSeq
#dropSqlBlockRule
+ | DROP ROW POLICY (IF EXISTS)? policyName=identifier
+ ON tableName=multipartIdentifier
+ (FOR (userIdentify | ROLE roleName=identifier))?
#dropRowPolicy
+ | DROP STORAGE POLICY (IF EXISTS)? name=identifier
#dropStoragePolicy
+ ;
+
+unsupportedStatsStatement
+ : ANALYZE TABLE name=multipartIdentifier partitionSpec?
+ columns=identifierList? (WITH analyzeProperties)* propertyClause?
#analyzeTable
+ | ANALYZE DATABASE name=multipartIdentifier
+ (WITH analyzeProperties)* propertyClause?
#analyzeDatabase
+ | ALTER TABLE name=multipartIdentifier SET STATS
+ LEFT_PAREN propertyItemList RIGHT_PAREN partitionSpec?
#alterTableStats
+ | ALTER TABLE name=multipartIdentifier (INDEX indexName=identifier)?
+ MODIFY COLUMN columnName=identifier
+ SET STATS LEFT_PAREN propertyItemList RIGHT_PAREN partitionSpec?
#alterColumnStats
+ | DROP STATS tableName=multipartIdentifier
+ columns=identifierList? partitionSpec?
#dropStats
+ | DROP CACHED STATS tableName=multipartIdentifier
#dropCachedStats
+ | DROP EXPIRED STATS
#dropExpiredStats
+ | DROP ANALYZE JOB INTEGER_VALUE
#dropAanalyzeJob
+ | KILL ANALYZE jobId=INTEGER_VALUE
#killAnalyzeJob
+ | SHOW TABLE STATS tableName=multipartIdentifier
+ partitionSpec? columnList=identifierList?
#showTableStats
+ | SHOW TABLE STATS tableId=INTEGER_VALUE
#showTableStats
+ | SHOW INDEX STATS tableName=multipartIdentifier indexId=identifier
#showIndexStats
+ | SHOW COLUMN CACHED? STATS tableName=multipartIdentifier
+ columnList=identifierList? partitionSpec?
#showColumnStats
+ | SHOW COLUMN HISTOGRAM tableName=multipartIdentifier
+ columnList=identifierList
#showColumnHistogramStats
+ | SHOW AUTO? ANALYZE tableName=multipartIdentifier? wildWhere?
#showAnalyze
+ | SHOW ANALYZE jobId=INTEGER_VALUE wildWhere?
#showAnalyzeFromJobId
+ | SHOW AUTO JOBS tableName=multipartIdentifier? wildWhere?
#showAutoAnalyzeJobs
+ | SHOW ANALYZE TASK STATUS jobId=INTEGER_VALUE
#showAnalyzeTask
+ ;
+
+analyzeProperties
+ : SYNC
+ | INCREMENTAL
+ | FULL
+ | SQL
+ | HISTOGRAM
+ | (SAMPLE ((ROWS rows=INTEGER_VALUE) | (PERCENT percent=INTEGER_VALUE)) )
+ | (BUCKETS bucket=INTEGER_VALUE)
+ | (PERIOD periodInSecond=INTEGER_VALUE)
+ | (CRON crontabExpr=STRING_LITERAL)
+ ;
+
+unsupportedCreateStatement
+ : CREATE (DATABASE | SCHEMA) (IF NOT EXISTS)? name=multipartIdentifier
+ properties=propertyClause?
#createDatabase
+ | CREATE CATALOG (IF NOT EXISTS)? catalogName=identifier
+ (WITH RESOURCE resourceName=identifier)?
+ (COMMENT STRING_LITERAL)? properties=propertyClause?
#createCatalog
+ | CREATE (GLOBAL | SESSION | LOCAL)?
+ (TABLES | AGGREGATE)? FUNCTION (IF NOT EXISTS)?
+ functionIdentifier LEFT_PAREN functionArguments? RIGHT_PAREN
+ RETURNS returnType=dataType (INTERMEDIATE intermediateType=dataType)?
+ properties=propertyClause?
#createUserDefineFunction
+ | CREATE (GLOBAL | SESSION | LOCAL)? ALIAS FUNCTION (IF NOT EXISTS)?
+ functionIdentifier LEFT_PAREN functionArguments? RIGHT_PAREN
+ WITH PARAMETER LEFT_PAREN parameters=identifierSeq? RIGHT_PAREN
+ AS expression
#createAliasFunction
+ | CREATE USER (IF NOT EXISTS)? grantUserIdentify
+ (SUPERUSER | DEFAULT ROLE role=STRING_LITERAL)?
+ passwordOption (COMMENT STRING_LITERAL)?
#createUser
+ | CREATE (READ ONLY)? REPOSITORY name=identifier WITH storageBackend
#createRepository
+ | CREATE ROLE (IF NOT EXISTS)? name=identifier (COMMENT STRING_LITERAL)?
#createRole
+ | CREATE FILE name=STRING_LITERAL
+ ((FROM | IN) database=identifier)? properties=propertyClause
#createFile
+ | CREATE INDEX (IF NOT EXISTS)? name=identifier
+ ON tableName=multipartIdentifier identifierList
+ (USING (BITMAP | NGRAM_BF | INVERTED))?
+ properties=propertyClause? (COMMENT STRING_LITERAL)?
#createIndex
+ | CREATE EXTERNAL? RESOURCE (IF NOT EXISTS)?
+ name=identifierOrText properties=propertyClause?
#createResource
+ | CREATE WORKLOAD GROUP (IF NOT EXISTS)?
+ name=identifierOrText properties=propertyClause?
#createWorkloadGroup
+ | CREATE WORKLOAD POLICY (IF NOT EXISTS)? name=identifierOrText
+ (CONDITIONS LEFT_PAREN workloadPolicyConditions RIGHT_PAREN)?
+ (ACTIONS LEFT_PAREN workloadPolicyActions RIGHT_PAREN)?
+ properties=propertyClause?
#createWorkloadPolicy
+ | CREATE ENCRYPTKEY (IF NOT EXISTS)? multipartIdentifier AS STRING_LITERAL
#createEncryptkey
+ | CREATE SQL_BLOCK_RULE (IF NOT EXISTS)?
+ name=identifier properties=propertyClause?
#createSqlBlockRule
+ | CREATE STORAGE POLICY (IF NOT EXISTS)?
+ name=identifier properties=propertyClause?
#createStoragePolicy
+ | BUILD INDEX name=identifier ON tableName=multipartIdentifier
+ partitionSpec?
#buildIndex
+ ;
+
+workloadPolicyActions
+ : workloadPolicyAction (COMMA workloadPolicyAction)*
+ ;
+
+workloadPolicyAction
+ : SET_SESSION_VARIABLE STRING_LITERAL
+ | identifier (STRING_LITERAL)?
+ ;
+
+workloadPolicyConditions
+ : workloadPolicyCondition (COMMA workloadPolicyCondition)*
+ ;
+
+workloadPolicyCondition
+ : metricName=identifier comparisonOperator (number | STRING_LITERAL)
+ ;
+
+storageBackend
+ : (BROKER | S3 | HDFS | LOCAL) brokerName=identifier?
+ ON LOCATION STRING_LITERAL properties=propertyClause?
+ ;
+
+passwordOption
+ : (PASSWORD_HISTORY (historyDefault=DEFAULT | historyValue=INTEGER_VALUE))?
+ (PASSWORD_EXPIRE (expireDefault=DEFAULT | expireNever=NEVER
+ | INTERVAL expireValue=INTEGER_VALUE expireTimeUnit=(DAY | HOUR |
SECOND)))?
+ (PASSWORD_REUSE INTERVAL (reuseDefault=DEFAULT |
reuseValue=INTEGER_VALUE DAY))?
+ (FAILED_LOGIN_ATTEMPTS attemptsValue=INTEGER_VALUE)?
+ (PASSWORD_LOCK_TIME (lockUnbounded=UNBOUNDED
+ | lockValue=INTEGER_VALUE lockTimeUint=(DAY | HOUR | SECOND)))?
+ (ACCOUNT_LOCK | ACCOUNT_UNLOCK)?
+ ;
+
+functionArguments
+ : functionArgument (COMMA functionArgument)*
+ ;
+
+functionArgument
+ : DOTDOTDOT
+ | dataType
+ ;
+
+unsupportedSetStatement
+ : SET (optionWithType | optionWithoutType)
+ (COMMA (optionWithType | optionWithoutType))*
#setOptions
+ | SET PROPERTY (FOR user=identifierOrText)? propertyItemList
#setUserProperties
| SET (GLOBAL | LOCAL | SESSION)? TRANSACTION
( transactionAccessMode
| isolationLevel
| transactionAccessMode COMMA isolationLevel
- | isolationLevel COMMA transactionAccessMode)
#setTransaction
- | SET NAMES (charsetName=identifierOrText | DEFAULT) (COLLATE
collateName=identifierOrText | DEFAULT)? #setCollate
- | SET PASSWORD (FOR userIdentify)? EQ (STRING_LITERAL | (PASSWORD
LEFT_PAREN STRING_LITERAL RIGHT_PAREN)) #setPassword
- | SET LDAP_ADMIN_PASSWORD EQ (STRING_LITERAL | (PASSWORD LEFT_PAREN
STRING_LITERAL RIGHT_PAREN)) #setLdapAdminPassword
- | USE (catalog=identifier DOT)? database=identifier
#useDatabase
- | USE ((catalog=identifier DOT)? database=identifier)? ATSIGN
cluster=identifier #useCloudCluster
+ | isolationLevel COMMA transactionAccessMode)
#setTransaction
+ ;
+
+optionWithType
+ : (GLOBAL | LOCAL | SESSION) identifier EQ (expression | DEFAULT)
+ ;
+
+optionWithoutType
+ : NAMES EQ expression
#setNames
+ | (CHAR SET | CHARSET) (charsetName=identifierOrText | DEFAULT)
#setCharset
+ | NAMES (charsetName=identifierOrText | DEFAULT)
+ (COLLATE collateName=identifierOrText | DEFAULT)?
#setCollate
+ | PASSWORD (FOR userIdentify)? EQ (STRING_LITERAL
+ | (PASSWORD LEFT_PAREN STRING_LITERAL RIGHT_PAREN))
#setPassword
+ | LDAP_ADMIN_PASSWORD EQ (STRING_LITERAL
+ | (PASSWORD LEFT_PAREN STRING_LITERAL RIGHT_PAREN))
#setLdapAdminPassword
+ | variable
#setVariableWithoutType
;
variable
- : (ATSIGN ATSIGN (GLOBAL | LOCAL | SESSION)?)? identifier EQ (expression |
DEFAULT) #setSystemVariable
+ : (DOUBLEATSIGN ((GLOBAL | LOCAL | SESSION) DOT)?)? identifier EQ
(expression | DEFAULT) #setSystemVariable
| ATSIGN identifier EQ expression #setUserVariable
;
@@ -156,6 +812,31 @@ isolationLevel
: ISOLATION LEVEL ((READ UNCOMMITTED) | (READ COMMITTED) | (REPEATABLE
READ) | (SERIALIZABLE))
;
+unsupoortedUnsetStatement
+ : UNSET (GLOBAL | SESSION | LOCAL)? VARIABLE (ALL | identifier)
+ ;
+
+unsupportedUseStatement
+ : USE (catalog=identifier DOT)? database=identifier
#useDatabase
+ | SWITCH catalog=identifier
#switchCatalog
+ ;
+
+unsupportedDmlStatement
+ : TRUNCATE TABLE multipartIdentifier specifiedPartition?
#truncateTable
+ ;
+
+unsupportedKillStatement
+ : KILL (CONNECTION)? INTEGER_VALUE #killConnection
+ | KILL QUERY (INTEGER_VALUE | STRING_LITERAL) #killQuery
+ ;
+
+unsupportedDescribeStatement
+ : explainCommand FUNCTION tvfName=identifier LEFT_PAREN
+ (properties=propertyItemList)? RIGHT_PAREN tableAlias
#describeTableValuedFunction
+ | explainCommand multipartIdentifier ALL
#describeTableAll
+ | explainCommand multipartIdentifier specifiedPartition? #describeTable
+ ;
+
constraint
: PRIMARY KEY slots=identifierList
| UNIQUE slots=identifierList
@@ -191,7 +872,7 @@ dataDesc
(PARTITION partition=identifierList)?
(COLUMNS TERMINATED BY comma=STRING_LITERAL)?
(LINES TERMINATED BY separator=STRING_LITERAL)?
- (FORMAT AS format=identifierOrStringLiteral)?
+ (FORMAT AS format=identifierOrText)?
(columns=identifierList)?
(columnsFromPath=colFromPath)?
(columnMapping=colMappingList)?
@@ -233,28 +914,47 @@ mvPartition
| partitionExpr = functionCallExpression
;
-identifierOrStringLiteral
+identifierOrText
: identifier
| STRING_LITERAL
;
-identifierOrText
- : errorCapturingIdentifier
+identifierOrTextOrAsterisk
+ : identifier
| STRING_LITERAL
- | LEADING_STRING
+ | ASTERISK
+ ;
+
+multipartIdentifierOrAsterisk
+ : parts+=identifierOrAsterisk (DOT parts+=identifierOrAsterisk)*
+ ;
+
+identifierOrAsterisk
+ : identifierOrText
+ | ASTERISK
;
userIdentify
- : user=identifierOrText (ATSIGN (host=identifierOrText | LEFT_PAREN
host=identifierOrText RIGHT_PAREN))?
+ : user=identifierOrText (ATSIGN (host=identifierOrText
+ | LEFT_PAREN host=identifierOrText RIGHT_PAREN))?
;
+grantUserIdentify
+ : userIdentify (IDENTIFIED BY PASSWORD? STRING_LITERAL)?
+ ;
explain
- : (EXPLAIN planType? | DESC | DESCRIBE)
+ : explainCommand planType?
level=(VERBOSE | TREE | GRAPH | PLAN)?
PROCESS?
;
+explainCommand
+ : EXPLAIN
+ | DESC
+ | DESCRIBE
+ ;
+
planType
: PARSED
| ANALYZED
@@ -317,7 +1017,7 @@ resourceDesc
;
mysqlDataDesc
- : DATA (LOCAL booleanValue)?
+ : DATA LOCAL?
INFILE filePath=STRING_LITERAL
INTO TABLE tableName=multipartIdentifier
(PARTITION partition=identifierList)?
@@ -467,11 +1167,11 @@ hintAssignment
: key=identifierOrText (EQ (constantValue=constant |
identifierValue=identifier))?
| constant
;
-
+
updateAssignment
: col=multipartIdentifier EQ (expression | DEFAULT)
;
-
+
updateAssignmentSeq
: assignments+=updateAssignment (COMMA assignments+=updateAssignment)*
;
@@ -533,9 +1233,9 @@ optScanParams
;
relationPrimary
- : multipartIdentifier optScanParams? materializedViewName?
specifiedPartition?
- tabletList? tableAlias sample? tableSnapshot? relationHint?
lateralView* #tableName
- | LEFT_PAREN query RIGHT_PAREN tableAlias lateralView*
#aliasedQuery
+ : multipartIdentifier optScanParams? materializedViewName? tableSnapshot?
specifiedPartition?
+ tabletList? tableAlias sample? relationHint? lateralView*
#tableName
+ | LEFT_PAREN query RIGHT_PAREN tableAlias lateralView*
#aliasedQuery
| tvfName=identifier LEFT_PAREN
(properties=propertyItemList)?
RIGHT_PAREN tableAlias
#tableValuedFunction
@@ -569,7 +1269,7 @@ tableAlias
multipartIdentifier
: parts+=errorCapturingIdentifier (DOT parts+=errorCapturingIdentifier)*
;
-
+
// ----------------Create Table Fields----------
simpleColumnDefs
: cols+=simpleColumnDef (COMMA cols+=simpleColumnDef)*
@@ -582,7 +1282,7 @@ simpleColumnDef
columnDefs
: cols+=columnDef (COMMA cols+=columnDef)*
;
-
+
columnDef
: colName=identifier type=dataType
KEY?
@@ -594,52 +1294,52 @@ columnDef
(ON UPDATE CURRENT_TIMESTAMP (LEFT_PAREN onUpdateValuePrecision=number
RIGHT_PAREN)?)?
(COMMENT comment=STRING_LITERAL)?
;
-
+
indexDefs
: indexes+=indexDef (COMMA indexes+=indexDef)*
;
-
+
indexDef
- : INDEX indexName=identifier cols=identifierList (USING indexType=(BITMAP
| INVERTED | NGRAM_BF))? (PROPERTIES LEFT_PAREN properties=propertyItemList
RIGHT_PAREN)? (COMMENT comment=STRING_LITERAL)?
+ : INDEX (IF NOT EXISTS)? indexName=identifier cols=identifierList (USING
indexType=(BITMAP | INVERTED | NGRAM_BF))? (PROPERTIES LEFT_PAREN
properties=propertyItemList RIGHT_PAREN)? (COMMENT comment=STRING_LITERAL)?
;
-
+
partitionsDef
: partitions+=partitionDef (COMMA partitions+=partitionDef)*
;
-
+
partitionDef
: (lessThanPartitionDef | fixedPartitionDef | stepPartitionDef |
inPartitionDef) (LEFT_PAREN partitionProperties=propertyItemList RIGHT_PAREN)?
;
-
+
lessThanPartitionDef
- : PARTITION (IF NOT EXISTS)? partitionName=identifier VALUES LESS THAN
(MAXVALUE | constantSeq)
+ : PARTITION (IF NOT EXISTS)? partitionName=identifier VALUES LESS THAN
(MAXVALUE | partitionValueList)
;
-
+
fixedPartitionDef
- : PARTITION (IF NOT EXISTS)? partitionName=identifier VALUES LEFT_BRACKET
lower=constantSeq COMMA upper=constantSeq RIGHT_PAREN
+ : PARTITION (IF NOT EXISTS)? partitionName=identifier VALUES LEFT_BRACKET
lower=partitionValueList COMMA upper=partitionValueList RIGHT_PAREN
;
stepPartitionDef
- : FROM from=constantSeq TO to=constantSeq INTERVAL
unitsAmount=INTEGER_VALUE unit=datetimeUnit?
+ : FROM from=partitionValueList TO to=partitionValueList INTERVAL
unitsAmount=INTEGER_VALUE unit=datetimeUnit?
;
inPartitionDef
- : PARTITION (IF NOT EXISTS)? partitionName=identifier (VALUES IN
((LEFT_PAREN constantSeqs+=constantSeq
- (COMMA constantSeqs+=constantSeq)* RIGHT_PAREN) |
constants=constantSeq))?
+ : PARTITION (IF NOT EXISTS)? partitionName=identifier (VALUES IN
((LEFT_PAREN partitionValueLists+=partitionValueList
+ (COMMA partitionValueLists+=partitionValueList)* RIGHT_PAREN) |
constants=partitionValueList))?
;
-
-constantSeq
+
+partitionValueList
: LEFT_PAREN values+=partitionValueDef (COMMA values+=partitionValueDef)*
RIGHT_PAREN
;
-
+
partitionValueDef
: INTEGER_VALUE | STRING_LITERAL | MAXVALUE | NULL
;
-
+
rollupDefs
: rollups+=rollupDef (COMMA rollups+=rollupDef)*
;
-
+
rollupDef
: rollupName=identifier rollupCols=identifierList (DUPLICATE KEY
dupKeys=identifierList)? properties=propertyClause?
;
@@ -651,7 +1351,7 @@ aggTypeDef
tabletList
: TABLET LEFT_PAREN tabletIdList+=INTEGER_VALUE (COMMA
tabletIdList+=INTEGER_VALUE)* RIGHT_PAREN
;
-
+
inlineTable
: VALUES rowConstructor (COMMA rowConstructor)*
@@ -705,6 +1405,7 @@ predicate
| NOT? kind=IN LEFT_PAREN query RIGHT_PAREN
| NOT? kind=IN LEFT_PAREN expression (COMMA expression)* RIGHT_PAREN
| IS NOT? kind=NULL
+ | IS NOT? kind=(TRUE | FALSE)
;
valueExpression
@@ -754,7 +1455,7 @@ primaryExpression
timestamp=valueExpression COMMA
(INTERVAL unitsAmount=valueExpression unit=datetimeUnit
| unitsAmount=valueExpression)
- RIGHT_PAREN
#dateFloor
+ RIGHT_PAREN
#dateFloor
| name=DATE_CEIL
LEFT_PAREN
timestamp=valueExpression COMMA
@@ -774,6 +1475,7 @@ primaryExpression
| name=LOCALTIME
#localTime
| name=LOCALTIMESTAMP
#localTimestamp
| name=CURRENT_USER
#currentUser
+ | name=SESSION_USER
#sessionUser
| CASE whenClause+ (ELSE elseExpression=expression)? END
#searchedCase
| CASE value=expression whenClause+ (ELSE elseExpression=expression)? END
#simpleCase
| name=CAST LEFT_PAREN expression AS dataType RIGHT_PAREN
#cast
@@ -784,9 +1486,9 @@ primaryExpression
| CHAR LEFT_PAREN
arguments+=expression (COMMA arguments+=expression)*
(USING charSet=identifierOrText)?
- RIGHT_PAREN
#charFunction
- | CONVERT LEFT_PAREN argument=expression USING charSet=identifierOrText
RIGHT_PAREN #convertCharSet
- | CONVERT LEFT_PAREN argument=expression COMMA type=dataType RIGHT_PAREN
#convertType
+ RIGHT_PAREN
#charFunction
+ | CONVERT LEFT_PAREN argument=expression USING charSet=identifierOrText
RIGHT_PAREN #convertCharSet
+ | CONVERT LEFT_PAREN argument=expression COMMA dataType RIGHT_PAREN
#convertType
| functionCallExpression
#functionCall
| value=primaryExpression LEFT_BRACKET index=valueExpression RIGHT_BRACKET
#elementAt
| value=primaryExpression LEFT_BRACKET begin=valueExpression
@@ -803,7 +1505,6 @@ primaryExpression
| primaryExpression COLLATE (identifier | STRING_LITERAL | DEFAULT)
#collate
;
-
functionCallExpression
: functionIdentifier
LEFT_PAREN (
@@ -814,7 +1515,7 @@ functionCallExpression
(OVER windowSpec)?
;
-functionIdentifier
+functionIdentifier
: (dbName=identifier DOT)? functionNameIdentifier
;
@@ -920,8 +1621,8 @@ dataType
(COMMA INTEGER_VALUE)* RIGHT_PAREN)?
#primitiveDataType
;
-primitiveColType:
- | type=TINYINT
+primitiveColType
+ : type=TINYINT
| type=SMALLINT
| (SIGNED | UNSIGNED)? type=(INT | INTEGER)
| type=BIGINT
@@ -1020,7 +1721,8 @@ number
// TODO: need to stay consistent with the legacy
nonReserved
//--DEFAULT-NON-RESERVED-START
- : ADDDATE
+ : ACTIONS
+ | ADDDATE
| AFTER
| AGG_STATE
| AGGREGATE
@@ -1072,6 +1774,7 @@ nonReserved
| COMPACT
| COMPLETE
| COMPRESS_TYPE
+ | CONDITIONS
| CONFIG
| CONNECTION
| CONNECTION_ID
@@ -1111,6 +1814,7 @@ nonReserved
| DEFERRED
| DEMAND
| DIAGNOSE
+ | DIAGNOSIS
| DISTINCTPC
| DISTINCTPCSA
| DO
@@ -1192,11 +1896,6 @@ nonReserved
| MAP
| MATCH_ALL
| MATCH_ANY
- | MATCH_columnName
- | MATCH_ELEMENT_GE
- | MATCH_ELEMENT_GT
- | MATCH_ELEMENT_LE
- | MATCH_ELEMENT_LT
| MATCH_PHRASE
| MATCH_PHRASE_EDGE
| MATCH_PHRASE_PREFIX
@@ -1284,6 +1983,7 @@ nonReserved
| SCHEMA
| SECOND
| SERIALIZABLE
+ | SET_SESSION_VARIABLE
| SEQUENCE
| SESSION
| SHAPE
@@ -1323,15 +2023,18 @@ nonReserved
| TYPES
| UNCOMMITTED
| UNLOCK
+ | UNSET
| UP
| USER
| VALUE
| VARCHAR
+ | VARIABLE
| VARIABLES
| VARIANT
| VERBOSE
| VERSION
| VIEW
+ | VIEWS
| WARM
| WARNINGS
| WEEK
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
index 61521bd7681..1f00ea381c0 100644
---
a/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
+++
b/fe/fe-core/src/main/java/org/apache/doris/nereids/parser/LogicalPlanBuilder.java
@@ -73,7 +73,6 @@ import
org.apache.doris.nereids.DorisParser.ComplexColTypeContext;
import org.apache.doris.nereids.DorisParser.ComplexColTypeListContext;
import org.apache.doris.nereids.DorisParser.ComplexDataTypeContext;
import org.apache.doris.nereids.DorisParser.ConstantContext;
-import org.apache.doris.nereids.DorisParser.ConstantSeqContext;
import org.apache.doris.nereids.DorisParser.CreateMTMVContext;
import org.apache.doris.nereids.DorisParser.CreateProcedureContext;
import org.apache.doris.nereids.DorisParser.CreateRowPolicyContext;
@@ -81,6 +80,7 @@ import
org.apache.doris.nereids.DorisParser.CreateTableContext;
import org.apache.doris.nereids.DorisParser.CreateTableLikeContext;
import org.apache.doris.nereids.DorisParser.CreateViewContext;
import org.apache.doris.nereids.DorisParser.CteContext;
+import org.apache.doris.nereids.DorisParser.DataTypeContext;
import org.apache.doris.nereids.DorisParser.DataTypeWithNullableContext;
import org.apache.doris.nereids.DorisParser.DateCeilContext;
import org.apache.doris.nereids.DorisParser.DateFloorContext;
@@ -135,6 +135,7 @@ import
org.apache.doris.nereids.DorisParser.OutFileClauseContext;
import org.apache.doris.nereids.DorisParser.ParenthesizedExpressionContext;
import org.apache.doris.nereids.DorisParser.PartitionSpecContext;
import org.apache.doris.nereids.DorisParser.PartitionValueDefContext;
+import org.apache.doris.nereids.DorisParser.PartitionValueListContext;
import org.apache.doris.nereids.DorisParser.PartitionsDefContext;
import org.apache.doris.nereids.DorisParser.PauseMTMVContext;
import org.apache.doris.nereids.DorisParser.PlanTypeContext;
@@ -788,7 +789,11 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
}
@Override
- public DropMTMVCommand visitDropMTMV(DropMTMVContext ctx) {
+ public Command visitDropMTMV(DropMTMVContext ctx) {
+ if (ctx.tableName != null) {
+ // TODO support drop sync mv
+ return new UnsupportedCommand();
+ }
List<String> nameParts = visitMultipartIdentifier(ctx.mvName);
return new DropMTMVCommand(new DropMTMVInfo(new
TableNameInfo(nameParts), ctx.EXISTS() != null));
}
@@ -1091,7 +1096,7 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
:
LoadTask.MergeType.valueOf(ddc.mergeType().getText());
Optional<String> fileFormat = ddc.format == null ? Optional.empty()
- : Optional.of(visitIdentifierOrStringLiteral(ddc.format));
+ : Optional.of(visitIdentifierOrText(ddc.format));
Optional<String> separator = ddc.separator == null ?
Optional.empty() : Optional.of(ddc.separator.getText()
.substring(1, ddc.separator.getText().length() - 1));
Optional<String> comma = ddc.comma == null ? Optional.empty() :
Optional.of(ddc.comma.getText()
@@ -1115,7 +1120,10 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
:
Optional.of(ddc.sequenceColumn.identifier().getText()), dataProperties));
}
String labelName = ctx.lableName.getText();
- Map<String, String> properties = visitPropertyItemList(ctx.properties);
+ Map<String, String> properties = Collections.emptyMap();
+ if (ctx.propertyClause() != null) {
+ properties =
visitPropertyItemList(ctx.propertyClause().propertyItemList());
+ }
String commentSpec = ctx.commentSpec() == null ? "''" :
ctx.commentSpec().STRING_LITERAL().getText();
String comment =
LogicalPlanBuilderAssistant.escapeBackSlash(commentSpec.substring(1,
commentSpec.length() - 1));
@@ -1191,15 +1199,6 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
@Override
public String visitIdentifierOrText(IdentifierOrTextContext ctx) {
- if (ctx.STRING_LITERAL() != null) {
- return ctx.STRING_LITERAL().getText().substring(1,
ctx.STRING_LITERAL().getText().length() - 1);
- } else {
- return ctx.errorCapturingIdentifier().getText();
- }
- }
-
- @Override
- public String
visitIdentifierOrStringLiteral(DorisParser.IdentifierOrStringLiteralContext
ctx) {
if (ctx.STRING_LITERAL() != null) {
return ctx.STRING_LITERAL().getText().substring(1,
ctx.STRING_LITERAL().getText().length() - 1);
} else {
@@ -2040,11 +2039,7 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
@Override
public Expression visitCast(DorisParser.CastContext ctx) {
- return ParserUtils.withOrigin(ctx, () -> {
- DataType dataType = ((DataType)
typedVisit(ctx.dataType())).conversion();
- Expression cast = new Cast(getExpression(ctx.expression()),
dataType, true);
- return processCast(cast, dataType);
- });
+ return ParserUtils.withOrigin(ctx, () ->
processCast(getExpression(ctx.expression()), ctx.dataType()));
}
@Override
@@ -2085,14 +2080,13 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
@Override
public Expression visitConvertType(DorisParser.ConvertTypeContext ctx) {
- return ParserUtils.withOrigin(ctx, () -> {
- DataType dataType = ((DataType) typedVisit(ctx.type)).conversion();
- Expression cast = new Cast(getExpression(ctx.argument), dataType,
true);
- return processCast(cast, dataType);
- });
+ return ParserUtils.withOrigin(ctx, () ->
processCast(getExpression(ctx.expression()), ctx.dataType()));
}
- private Expression processCast(Expression cast, DataType dataType) {
+ private Expression processCast(Expression expression, DataTypeContext
dataTypeCtx) {
+ DataType dataType = typedVisit(dataTypeCtx);
+ dataType = dataType.conversion();
+ Expression cast = new Cast(expression, dataType, true);
if (dataType.isStringLikeType() && ((CharacterType) dataType).getLen()
>= 0) {
if (dataType.isVarcharType() && ((VarcharType)
dataType).isWildcardVarchar()) {
return cast;
@@ -2783,7 +2777,7 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
public PartitionDefinition
visitLessThanPartitionDef(LessThanPartitionDefContext ctx) {
String partitionName = ctx.partitionName.getText();
if (ctx.MAXVALUE() == null) {
- List<Expression> lessThanValues =
visitConstantSeq(ctx.constantSeq());
+ List<Expression> lessThanValues =
visitPartitionValueList(ctx.partitionValueList());
return new LessThanPartition(ctx.EXISTS() != null, partitionName,
lessThanValues);
} else {
return new LessThanPartition(ctx.EXISTS() != null, partitionName,
@@ -2794,15 +2788,15 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
@Override
public PartitionDefinition visitFixedPartitionDef(FixedPartitionDefContext
ctx) {
String partitionName = ctx.partitionName.getText();
- List<Expression> lowerBounds = visitConstantSeq(ctx.lower);
- List<Expression> upperBounds = visitConstantSeq(ctx.upper);
+ List<Expression> lowerBounds = visitPartitionValueList(ctx.lower);
+ List<Expression> upperBounds = visitPartitionValueList(ctx.upper);
return new FixedRangePartition(ctx.EXISTS() != null, partitionName,
lowerBounds, upperBounds);
}
@Override
public PartitionDefinition visitStepPartitionDef(StepPartitionDefContext
ctx) {
- List<Expression> fromExpression = visitConstantSeq(ctx.from);
- List<Expression> toExpression = visitConstantSeq(ctx.to);
+ List<Expression> fromExpression = visitPartitionValueList(ctx.from);
+ List<Expression> toExpression = visitPartitionValueList(ctx.to);
return new StepPartition(false, null, fromExpression, toExpression,
Long.parseLong(ctx.unitsAmount.getText()), ctx.unit != null ?
ctx.unit.getText() : null);
}
@@ -2811,17 +2805,17 @@ public class LogicalPlanBuilder extends
DorisParserBaseVisitor<Object> {
public PartitionDefinition visitInPartitionDef(InPartitionDefContext ctx) {
List<List<Expression>> values;
if (ctx.constants == null) {
- values = ctx.constantSeqs.stream().map(this::visitConstantSeq)
+ values =
ctx.partitionValueLists.stream().map(this::visitPartitionValueList)
.collect(Collectors.toList());
} else {
- values =
visitConstantSeq(ctx.constants).stream().map(ImmutableList::of)
+ values =
visitPartitionValueList(ctx.constants).stream().map(ImmutableList::of)
.collect(Collectors.toList());
}
return new InPartition(ctx.EXISTS() != null,
ctx.partitionName.getText(), values);
}
@Override
- public List<Expression> visitConstantSeq(ConstantSeqContext ctx) {
+ public List<Expression> visitPartitionValueList(PartitionValueListContext
ctx) {
return ctx.values.stream()
.map(this::visitPartitionValueDef)
.collect(Collectors.toList());
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
index 84aed148106..c140ff064e4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java
@@ -149,6 +149,7 @@ import
org.apache.doris.nereids.trees.plans.commands.DeleteFromCommand;
import org.apache.doris.nereids.trees.plans.commands.Forward;
import org.apache.doris.nereids.trees.plans.commands.NotAllowFallback;
import org.apache.doris.nereids.trees.plans.commands.PrepareCommand;
+import org.apache.doris.nereids.trees.plans.commands.UnsupportedCommand;
import
org.apache.doris.nereids.trees.plans.commands.insert.BatchInsertIntoTableCommand;
import
org.apache.doris.nereids.trees.plans.commands.insert.InsertIntoTableCommand;
import
org.apache.doris.nereids.trees.plans.commands.insert.InsertOverwriteTableCommand;
@@ -670,7 +671,8 @@ public class StmtExecutor {
// when we in transaction mode, we only support insert into command
and transaction command
if (context.isTxnModel()) {
if (!(logicalPlan instanceof BatchInsertIntoTableCommand
- || logicalPlan instanceof InsertIntoTableCommand)) {
+ || logicalPlan instanceof InsertIntoTableCommand
+ || logicalPlan instanceof UnsupportedCommand)) {
String errMsg = "This is in a transaction, only insert,
commit, rollback is acceptable.";
throw new NereidsException(errMsg, new
AnalysisException(errMsg));
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]