This is an automated email from the ASF dual-hosted git repository.
chengzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 199ae6e2089 Add oracle alter table modifyTableSubpartition parse
(#28239)
199ae6e2089 is described below
commit 199ae6e2089485eefa22a810d60390f1b9302dfa
Author: niu niu <[email protected]>
AuthorDate: Fri Aug 25 15:08:19 2023 +0800
Add oracle alter table modifyTableSubpartition parse (#28239)
---
.../src/main/antlr4/imports/oracle/DDLStatement.g4 | 11 ++++++
.../src/main/resources/case/ddl/alter-table.xml | 39 ++++++++++++++++++++++
.../resources/sql/supported/ddl/alter-table.xml | 6 ++++
3 files changed, 56 insertions(+)
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 9874688943d..8b6e72a5fb3 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
@@ -1264,6 +1264,7 @@ alterTablePartitioning
: modifyTableDefaultAttrs
| setSubpartitionTemplate
| modifyTablePartition
+ | modifyTableSubpartition
| moveTablePartition
| addTablePartition
| coalesceTablePartition
@@ -1304,6 +1305,16 @@ modifyListPartition
| coalesceTableSubpartition | REBUILD? UNUSABLE LOCAL INDEXES |
readOnlyClause | indexingClause)
;
+modifyTableSubpartition
+ : MODIFY subpartitionExtendedName (allocateExtentClause
+ | deallocateUnusedClause | shrinkClause | ((LOB lobItem | VARRAY
varrayType) LP_ modifylobParameters RP_)+ | REBUILD? UNUSABLE LOCAL INDEXES
+ | (ADD | DROP) VALUES LP_ listValues RP_ | readOnlyClause | indexingClause)
+ ;
+
+subpartitionExtendedName
+ : SUBPARTITION (subpartitionName | FOR LP_ subpartitionKeyValue (COMMA_
subpartitionKeyValue)* RP_)
+ ;
+
partitionExtendedName
: PARTITION partitionName
| PARTITION FOR LP_ partitionKeyValue (COMMA_ partitionKeyValue)* RP_
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 bb7645b4855..0770df10f77 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
@@ -125,6 +125,24 @@
</modify-column>
</alter-table>
+ <alter-table sql-case-id="alter_table_modify10">
+ <table name="locations_demo" start-index="12" stop-index="25" />
+ <modify-column>
+ <column-definition start-index="35" stop-index="75">
+ <column name="country_id" />
+ </column-definition>
+ </modify-column>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_modify11">
+ <table name="product_information" start-index="12" stop-index="30" />
+ <modify-column>
+ <column-definition start-index="40" stop-index="61">
+ <column name="min_price" />
+ </column-definition>
+ </modify-column>
+ </alter-table>
+
<alter-table sql-case-id="alter_table_add_constraint">
<table name="employees" start-index="12" stop-index="20" />
<add-constraint constraint-name="emp_emp_id_pk" start-index="27"
stop-index="76">
@@ -1529,4 +1547,25 @@
<referenced-table start-index="80" stop-index="88"
name="time_view" />
</add-constraint>
</alter-table>
+
+ <alter-table sql-case-id="alter_table_modify_lob_nocache">
+ <table name="employees" start-index="12" stop-index="20" />
+ <modify-column>
+ <column-definition start-index="29" stop-index="31">
+ <column name="LOB" />
+ </column-definition>
+ </modify-column>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_move_tablespace1">
+ <table name="people_tab" start-index="12" stop-index="21" />
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_move_tablespace2">
+ <table name="people_column_nt" start-index="12" stop-index="27" />
+ </alter-table>
+
+ <alter-table
sql-case-id="alter_table_modify_subpartition_rebuild_unusable_local_indexes">
+ <table name="emp" start-index="12" stop-index="14" />
+ </alter-table>
</sql-parser-test-cases>
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 b38290934ff..99a84e9241c 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
@@ -30,6 +30,8 @@
<sql-case id="alter_table_modify7" value="ALTER TABLE locations MODIFY
PRIMARY KEY DISABLE CASCADE" db-types="Oracle" />
<sql-case id="alter_table_modify8" value="ALTER TABLE employees MODIFY
(salary ENCRYPT USING 'AES256' 'NOMAC')" db-types="Oracle" />
<sql-case id="alter_table_modify9" value="ALTER TABLE sales MODIFY
CONSTRAINT time_view_fk RELY" db-types="Oracle" />
+ <sql-case id="alter_table_modify10" value="ALTER TABLE locations_demo
MODIFY (country_id CONSTRAINT country_nn NOT NULL)" db-types="Oracle" />
+ <sql-case id="alter_table_modify11" value="ALTER TABLE product_information
MODIFY (min_price DEFAULT NULL)" db-types="Oracle" />
<sql-case id="alter_table_add_constraint" value="ALTER TABLE employees ADD
(CONSTRAINT emp_emp_id_pk PRIMARY KEY (employee_id), CONSTRAINT emp_dept_fk
FOREIGN KEY (department_id) REFERENCES departments, CONSTRAINT emp_job_fk
FOREIGN KEY (job_id) REFERENCES jobs (job_id), CONSTRAINT emp_manager_fk
FOREIGN KEY (manager_id) REFERENCES employees)" db-types="Oracle" />
<sql-case id="alter_table_no_flashback_archive" value="ALTER TABLE
employee NO FLASHBACK ARCHIVE" db-types="Oracle" />
<sql-case id="alter_table_move_tablespace_overflow_tablespace"
value="ALTER TABLE admin_docindex MOVE TABLESPACE admin_tbs2 OVERFLOW
TABLESPACE admin_tbs3" db-types="Oracle" />
@@ -198,4 +200,8 @@
<sql-case
id="alter_table_modify_default_attributes_for_partition_tablespace"
value="ALTER TABLE emp MODIFY DEFAULT ATTRIBUTES FOR PARTITION p1 TABLESPACE
ts1" db-types="Oracle" />
<sql-case id="alter_table_ref_with_rowid" value="ALTER TABLE emp ADD
(REF(column_value) WITH ROWID)" db-types="Oracle" />
<sql-case
id="alter_table_add_constraint_foreign_key_references_disable_novalidate"
value="ALTER TABLE sales ADD (CONSTRAINT time_view_fk FOREIGN KEY (time_id)
REFERENCES time_view(time_id) DISABLE NOVALIDATE)" db-types="Oracle" />
+ <sql-case id="alter_table_modify_lob_nocache" value="ALTER TABLE employees
MODIFY LOB (resume) (NOCACHE)" db-types="Oracle" />
+ <sql-case id="alter_table_move_tablespace1" value="ALTER TABLE people_tab
MOVE TABLESPACE system" db-types="Oracle" />
+ <sql-case id="alter_table_move_tablespace2" value="ALTER TABLE
people_column_nt MOVE TABLESPACE example" db-types="Oracle" />
+ <sql-case
id="alter_table_modify_subpartition_rebuild_unusable_local_indexes"
value="ALTER TABLE emp MODIFY SUBPARTITION p3_s1 REBUILD UNUSABLE LOCAL
INDEXES" db-types="Oracle" />
</sql-cases>