From c3171c1c3ffc8738c92dbc87eea387738846b759 Mon Sep 17 00:00:00 2001 From: niu niu Date: Fri, 15 Sep 2023 16:38:19 +0800 Subject: [PATCH] Enhance Oracle alter table syntax rules (#28444) --- .../antlr4/imports/oracle/DDLStatement.g4 | 8 ++++- .../main/resources/case/ddl/alter-table.xml | 34 +++++++++++++++++-- .../sql/supported/ddl/alter-table.xml | 7 +++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4 b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4 index a87aa7a94aa41..7a35c2a437286 100644 --- a/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4 +++ b/parser/sql/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4 @@ -289,6 +289,7 @@ relationalProperty columnDefinition : columnName REF? dataType SORT? visibleClause (defaultNullClause expr | identityClause)? (ENCRYPT encryptionSpecification)? (inlineConstraint+ | inlineRefConstraint)? | REF LP_ columnName RP_ WITH ROWID + | SCOPE FOR LP_ columnName RP_ IS identifier ; visibleClause @@ -715,7 +716,7 @@ rebuildClause ; parallelClause - : NOPARALLEL | PARALLEL NUMBER_? + : NOPARALLEL | PARALLEL (INTEGER_ | LP_ DEGREE INTEGER_ RP_)? ; usableSpecification @@ -1293,6 +1294,7 @@ alterTablePartitioning | modifyTablePartition | modifyTableSubpartition | moveTablePartition + | moveTableSubPartition | addTablePartition | coalesceTablePartition | dropTablePartition @@ -1423,6 +1425,10 @@ moveTablePartition : MOVE partitionExtendedName (MAPPING TABLE)? tablePartitionDescription? filterCondition? updateAllIndexesClause? parallelClause? allowDisallowClustering? ONLINE? ; +moveTableSubPartition + : MOVE subpartitionExtendedName indexingClause? partitioningStorageClause? updateIndexClauses? filterCondition? parallelClause? allowDisallowClustering? ONLINE? + ; + filterCondition : INCLUDING ROWS whereClause ; diff --git a/test/it/parser/src/main/resources/case/ddl/alter-table.xml b/test/it/parser/src/main/resources/case/ddl/alter-table.xml index 92dd1641cabb9..adb5985c32e9c 100644 --- a/test/it/parser/src/main/resources/case/ddl/alter-table.xml +++ b/test/it/parser/src/main/resources/case/ddl/alter-table.xml @@ -1633,6 +1633,10 @@ + + +
+
@@ -1658,10 +1662,14 @@
- +
- + + +
+ +
@@ -1672,4 +1680,26 @@ + + +
+ + + +
+ + + + + + + + +
+ + + + + + diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml b/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml index 3c9a480dc3f19..12195abe562d0 100644 --- a/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml +++ b/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml @@ -215,11 +215,16 @@ + - + + + + +