This is an automated email from the ASF dual-hosted git repository.

duanzhengqiang 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 f1a30c52961 Support Hive CREATE TABLE about iceberg statement parse 
(#37186)
f1a30c52961 is described below

commit f1a30c529612ecaad834604ac2bf0384c7386e0c
Author: Claire <[email protected]>
AuthorDate: Fri Nov 28 17:12:35 2025 +0800

    Support Hive CREATE TABLE about iceberg statement parse (#37186)
    
    * create table iceberg
    
    * update release notes
---
 RELEASE-NOTES.md                                   |  2 +-
 .../src/main/antlr4/imports/hive/DDLStatement.g4   |  6 ++++-
 .../hive/src/main/antlr4/imports/hive/Keyword.g4   |  4 ++++
 .../src/main/resources/case/ddl/create-table.xml   | 28 ++++++++++++++++++++++
 .../resources/sql/supported/ddl/create-table.xml   |  3 +++
 5 files changed, 41 insertions(+), 2 deletions(-)

diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 972d6dfeaa7..bb049b10410 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -37,7 +37,7 @@
 1. SQL Parser: Support to parse more SQL statements for MySQL - 
[#36689](https://github.com/apache/shardingsphere/issues/36689)
 1. SQL Parser: Support to parse more SQL statements for SQLServer - 
[#36695](https://github.com/apache/shardingsphere/issues/36695)
 1. SQL Parser: Support to parse more SQL statements for Oracle - 
[#36696](https://github.com/apache/shardingsphere/issues/36696)
-1. SQL Parser: Support to parse more SQL statements for Hive - 
[#36694](https://github.com/apache/shardingsphere/pull/36694)
+1. SQL Parser: Support to parse more SQL statements for Hive - 
[#36694](https://github.com/apache/shardingsphere/pull/36694) 
[#37074](https://github.com/apache/shardingsphere/pull/37074)
 1. SQL Parser: Support to parse CREATE MATERIALIZED VIEW for Doris - 
[#31499](https://github.com/apache/shardingsphere/pull/31499)
 1. SQL Parser: Support to parse CREATE FUNCTION with $$ symbol for PostgreSQL 
and openGauss - [#35947](https://github.com/apache/shardingsphere/pull/35947)
 1. SQL Binder: Support to bind more SQL statements - 
[#36697](https://github.com/apache/shardingsphere/pull/36697)
diff --git 
a/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/DDLStatement.g4 
b/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/DDLStatement.g4
index f807ba107ea..65341fcb039 100644
--- 
a/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/DDLStatement.g4
+++ 
b/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/DDLStatement.g4
@@ -36,7 +36,7 @@ use
     ;
 
 createTable
-    : createTableCommonClause createDefinitionClause? commentClause? 
partitionedBy? clusteredBy? skewedBy? rowFormat? storedClause? storageLocation? 
tblProperties? (AS select)?
+    : createTableCommonClause createDefinitionClause? commentClause? 
partitionedBy? clusteredBy? skewedBy? rowFormat? storedByIceberg? storedClause? 
storageLocation? tblProperties? (AS select)?
     | createTableCommonClause LIKE existingTableName storageLocation?
     ;
 
@@ -354,6 +354,10 @@ tblProperties
     : TBLPROPERTIES propertyListCommonClause
     ;
 
+storedByIceberg
+    : STORED BY ICEBERG
+    ;
+
 addConstraint
     : ADD CONSTRAINT constraintName
     ;
diff --git 
a/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/Keyword.g4 
b/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/Keyword.g4
index e3bf78ffd1e..17bf00fe94f 100644
--- a/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/Keyword.g4
+++ b/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/Keyword.g4
@@ -118,3 +118,7 @@ REDO_LOG
 DELIMITER
     : D E L I M I T E R
     ;
+
+ICEBERG
+    : I C E B E R G
+    ;
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 425836d0ea5..bd865aae4ab 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
@@ -3673,6 +3673,34 @@
         <tblproperties properties="" start-index="0" stop-index="0" />
     </create-table>
 
+    <create-table sql-case-id="create_iceberg_table">
+        <table name="user_log" temporary="false" external="true" 
if-not-exists="false" start-index="22" stop-index="29" />
+        <column-definition type="STRING" start-index="32" stop-index="47" >
+            <column name="user_name" />
+        </column-definition>
+        <stored-by handler="ICEBERG" start-index="61" stop-index="68" />
+    </create-table>
+    
+    <create-table sql-case-id="create_iceberg_table_partition">
+        <table name="user_log" temporary="false" external="false" 
if-not-exists="false" start-index="13" stop-index="20" />
+        <column-definition type="STRING" start-index="23" stop-index="38" >
+            <column name="user_name" />
+        </column-definition>
+        <partition column="year" type="int" start-index="57" stop-index="66"  >
+            <column name="year" />
+        </partition>
+        <stored-by handler="ICEBERG" start-index="81" stop-index="88" />
+    </create-table>
+    
+    <create-table sql-case-id="create_iceberg_table_orc">
+        <table name="user_log" temporary="false" external="false" 
if-not-exists="false" start-index="13" stop-index="20" />
+        <column-definition type="STRING" start-index="23" stop-index="38" >
+            <column name="user_name" />
+        </column-definition>
+        <storage-handler name="ICEBERG" start-index="54" stop-index="61" />
+        <storage-format type="ORC" start-index="73" stop-index="76" />
+    </create-table>
+
     <create-table sql-case-id="create_table_with_blob">
         <table name="t_blob" start-index="13" stop-index="18" />
         <column-definition type="INT" start-index="21" stop-index="26">
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 4050ae7b96c..4109ac1424f 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
@@ -509,6 +509,9 @@
           JOIN dim_dates ds ON u.date_id = ds.date_id
           WHERE u.status = 'active';" db-types="Hive" />
     <sql-case id="create_table_like_all_options" value="CREATE TEMPORARY 
EXTERNAL TABLE IF NOT EXISTS test_db.target_table LIKE source_db.source_table 
LOCATION '/user/hive/warehouse/test_db.db/target_table';" db-types="Hive" />
+    <sql-case id="create_iceberg_table" value="CREATE EXTERNAL TABLE user_log 
(user_name STRING) STORED BY ICEBERG;" db-types="Hive" />
+    <sql-case id="create_iceberg_table_partition" value="CREATE TABLE user_log 
(user_name STRING) PARTITIONED BY (year int) STORED BY ICEBERG;" 
db-types="Hive" />
+    <sql-case id="create_iceberg_table_orc" value="CREATE TABLE user_log 
(user_name STRING) STORED BY ICEBERG STORED AS ORC;" db-types="Hive" />
     <sql-case id="create_table_with_blob" value="CREATE TABLE t_blob (id INT, 
payload BLOB)" db-types="Firebird" />
     <sql-case id="create_table_with_blob_subtype_numeric" value="CREATE TABLE 
t_blob_subtype_numeric (payload BLOB SUB_TYPE 1)" db-types="Firebird" />
     <sql-case id="create_table_with_blob_subtype_text" value="CREATE TABLE 
t_blob_subtype_text (payload BLOB SUB_TYPE TEXT CHARACTER SET UTF8)" 
db-types="Firebird" />

Reply via email to