You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2026/08/22 11:27:06 UTC
(shardingsphere) branch master updated: Support Oracle CREATE TABLE compression clause parse after partitioning clauses (#39555)
This is an automated email from the ASF dual-hosted git repository.
terrymanu 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 b3cdad82cb2 Support Oracle CREATE TABLE compression clause parse after partitioning clauses (#39555)
b3cdad82cb2 is described below
commit b3cdad82cb247f4f8e923fe74ad26cd99845ed9e
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Aug 22 19:26:59 2026 +0800
Support Oracle CREATE TABLE compression clause parse after partitioning clauses (#39555)
- Add optional tableCompression to tableProperties in Oracle DDLStatement.g4, so
table-level COMPRESS/NOCOMPRESS can follow partitioning and parallel clauses
(e.g. the page_history statement in #27102).
- Add parser IT cases for the CREATE TABLE statements listed in #27102:
range-partitioned CTAS with partition storage attributes and MAXVALUE,
interval + hash subpartitioning with PARALLEL n COMPRESS, and
list-partitioned CTAS.
Closes #27102
---
.../src/main/antlr4/imports/oracle/DDLStatement.g4 | 2 +-
.../src/main/resources/case/ddl/create-table.xml | 73 ++++++++++++++++++++++
.../resources/sql/supported/ddl/create-table.xml | 3 +
3 files changed, 77 insertions(+), 1 deletion(-)
diff --git a/parser/sql/engine/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4 b/parser/sql/engine/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
index 95f7616ab2c..625bee17ca9 100644
--- a/parser/sql/engine/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
+++ b/parser/sql/engine/dialect/oracle/src/main/antlr4/imports/oracle/DDLStatement.g4
@@ -1191,7 +1191,7 @@ clusterRelatedClause
;
tableProperties
- : columnProperties? readOnlyClause? indexingClause? tablePartitioningClauses? attributeClusteringClause? (CACHE | NOCACHE)? parallelClause?
+ : columnProperties? readOnlyClause? indexingClause? tablePartitioningClauses? attributeClusteringClause? (CACHE | NOCACHE)? parallelClause? tableCompression?
( RESULT_CACHE (LP_ MODE (DEFAULT | FORCE) RP_))? (ROWDEPENDENCIES | NOROWDEPENDENCIES)? enableDisableClause* rowMovementClause? logicalReplicationClause? flashbackArchiveClause?
( ROW ARCHIVAL)? (AS selectSubquery | FOR EXCHANGE WITH TABLE tableName)?
;
diff --git a/test/it/parser/src/main/resources/case/ddl/create-table.xml b/test/it/parser/src/main/resources/case/ddl/create-table.xml
index a49c643837c..bb13c86d219 100644
--- a/test/it/parser/src/main/resources/case/ddl/create-table.xml
+++ b/test/it/parser/src/main/resources/case/ddl/create-table.xml
@@ -2522,6 +2522,79 @@
</select>
</create-table>
+ <create-table sql-case-id="create_table_partition_by_range_with_storage_as_select" db-types="Oracle">
+ <table name="part_sales_by_time" start-index="13" stop-index="30" />
+ <column name="time_id" start-index="33" stop-index="39" />
+ <column name="prod_id" start-index="42" stop-index="48" />
+ <column name="amount_sold" start-index="51" stop-index="61" />
+ <column name="quantity_sold" start-index="64" stop-index="76" />
+ <select>
+ <projections start-index="733" stop-index="784">
+ <column-projection name="time_id" start-index="733" stop-index="741">
+ <owner name="s" start-index="733" stop-index="733" />
+ </column-projection>
+ <column-projection name="prod_id" start-index="744" stop-index="752">
+ <owner name="s" start-index="744" stop-index="744" />
+ </column-projection>
+ <column-projection name="amount_sold" start-index="755" stop-index="767">
+ <owner name="s" start-index="755" stop-index="755" />
+ </column-projection>
+ <column-projection name="quantity_sold" start-index="770" stop-index="784">
+ <owner name="s" start-index="770" stop-index="770" />
+ </column-projection>
+ </projections>
+ <from>
+ <simple-table name="sales" alias="s" start-index="791" stop-index="797" />
+ </from>
+ </select>
+ </create-table>
+
+ <create-table sql-case-id="create_table_partition_by_range_interval_subpartition_by_hash_with_compress" db-types="Oracle">
+ <table name="page_history" start-index="13" stop-index="24" />
+ <column-definition type="NUMBER" start-index="27" stop-index="44">
+ <column name="id" start-index="27" stop-index="28" />
+ </column-definition>
+ <column-definition type="VARCHAR2" start-index="47" stop-index="72">
+ <column name="url" start-index="47" stop-index="49" />
+ </column-definition>
+ <column-definition type="DATE" start-index="75" stop-index="97">
+ <column name="view_date" start-index="75" stop-index="83" />
+ </column-definition>
+ <column-definition type="VARCHAR2" start-index="100" stop-index="130">
+ <column name="client_ip" start-index="100" stop-index="108" />
+ </column-definition>
+ <column-definition type="VARCHAR2" start-index="133" stop-index="154">
+ <column name="from_url" start-index="133" stop-index="140" />
+ </column-definition>
+ <column-definition type="VARCHAR2" start-index="157" stop-index="176">
+ <column name="to_url" start-index="157" stop-index="162" />
+ </column-definition>
+ <column-definition type="NUMBER" start-index="179" stop-index="202">
+ <column name="timing_in_seconds" start-index="179" stop-index="195" />
+ </column-definition>
+ </create-table>
+
+ <create-table sql-case-id="create_table_partition_by_list_as_select" db-types="Oracle">
+ <table name="product_par_list" start-index="13" stop-index="28" />
+ <column name="prod_id" start-index="31" stop-index="37" />
+ <column name="prod_name" start-index="40" stop-index="48" />
+ <column name="prod_category" start-index="51" stop-index="63" />
+ <column name="prod_subcategory" start-index="66" stop-index="81" />
+ <column name="prod_list_price" start-index="84" stop-index="98" />
+ <select>
+ <projections start-index="237" stop-index="304">
+ <column-projection name="prod_id" start-index="237" stop-index="243" />
+ <column-projection name="prod_name" start-index="246" stop-index="254" />
+ <column-projection name="prod_category" start-index="257" stop-index="269" />
+ <column-projection name="prod_subcategory" start-index="272" stop-index="287" />
+ <column-projection name="prod_list_price" start-index="290" stop-index="304" />
+ </projections>
+ <from>
+ <simple-table name="products" start-index="311" stop-index="318" />
+ </from>
+ </select>
+ </create-table>
+
<create-table sql-case-id="create_table_as_select_with_pivot" db-types="Oracle">
<table name="pivot_table" start-index="13" stop-index="23"/>
<select>
diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml b/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
index b850629bea8..9c9a068a510 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
@@ -366,6 +366,9 @@
<sql-case id="create_table_with_as_sub_query" value="CREATE TABLE employees_temp AS SELECT * FROM EMPLOYEES;" db-types="Oracle"/>
<sql-case id="create_table_partition_by_hash_parallel_as_select" value="CREATE TABLE dept_hash PARTITION BY HASH(department_id) PARTITIONS 3 PARALLEL 2 AS SELECT * FROM departments" db-types="Oracle"/>
<sql-case id="create_table_partition_by_range_as_select" value="CREATE TABLE emp_range PARTITION BY RANGE(hire_date) (PARTITION emp_p1 VALUES LESS THAN (TO_DATE('1-JAN-1992','DD-MON-YYYY')), PARTITION emp_p2 VALUES LESS THAN (TO_DATE('1-JAN-1994','DD-MON-YYYY')), PARTITION emp_p3 VALUES LESS THAN (TO_DATE('1-JAN-1996','DD-MON-YYYY')), PARTITION emp_p4 VALUES LESS THAN (TO_DATE('1-JAN-1998','DD-MON-YYYY')), PARTITION emp_p5 VALUES LESS THAN (TO_DATE('1-JAN-2001','DD-MON-YYYY'))) AS SE [...]
+ <sql-case id="create_table_partition_by_range_with_storage_as_select" value="CREATE TABLE part_sales_by_time (time_id, prod_id, amount_sold, quantity_sold) PARTITION BY RANGE (time_id) (PARTITION old_data VALUES LESS THAN (TO_DATE('01-01-1999', 'DD-MM-YYYY')) PCTFREE 0 STORAGE (INITIAL 8M), PARTITION quarter1 VALUES LESS THAN (TO_DATE('01-04-1999', 'DD-MM-YYYY')) PCTFREE 0 STORAGE (INITIAL 8M), PARTITION quarter2 VALUES LESS THAN (TO_DATE('01-07-1999', 'DD-MM-YYYY')) PCTFREE 0 STORAG [...]
+ <sql-case id="create_table_partition_by_range_interval_subpartition_by_hash_with_compress" value="CREATE TABLE page_history (id NUMBER NOT NULL, url VARCHAR2(300) NOT NULL, view_date DATE NOT NULL, client_ip VARCHAR2(23) NOT NULL, from_url VARCHAR2(300), to_url VARCHAR2(300), timing_in_seconds NUMBER) PARTITION BY RANGE(view_date) INTERVAL (NUMTODSINTERVAL(1,'DAY')) SUBPARTITION BY HASH(client_ip) SUBPARTITIONS 32 (PARTITION p0 VALUES LESS THAN (TO_DATE('01-JAN-2006','dd-MON-yyyy'))) [...]
+ <sql-case id="create_table_partition_by_list_as_select" value="CREATE TABLE product_par_list (prod_id, prod_name, prod_category, prod_subcategory, prod_list_price) PARTITION BY LIST (prod_category) (PARTITION prod_cat1 VALUES ('Boys', 'Men'), PARTITION prod_cat2 VALUES ('Girls', 'Women')) AS SELECT prod_id, prod_name, prod_category, prod_subcategory, prod_list_price FROM products" db-types="Oracle"/>
<sql-case id="create_table_parallel_with_as_sub_query" value="CREATE TABLE hr.admin_emp_dept PARALLEL COMPRESS AS SELECT * FROM hr.employees WHERE department_id = 10;" db-types="Oracle"/>
<sql-case id="create_table_with_edge_constraint" value="CREATE TABLE bought ( PurchaseCount INT ,CONSTRAINT EC_BOUGHT CONNECTION (Customer TO Product) ON DELETE NO ACTION );" db-types="SQLServer"/>
<sql-case id="create_table_with_enclosed" value="CREATE TABLE emp_load(first_name CHAR(15), last_name CHAR(20), year_of_birth CHAR(4)) ORGANIZATION EXTERNAL (TYPE ORACLE_LOADER DEFAULT DIRECTORY ext_tab_dir ACCESS PARAMETERS FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '(' and ')'LRTRIM LOCATION (info.dat));" db-types="Oracle"/>