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

strongduanmu 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 dbdfd77bc28 Support Hive DELETE ORPHAN-FILES Statement about iceberg 
statement parse (#38669)
dbdfd77bc28 is described below

commit dbdfd77bc2860244fd17002883b71cf43412d2e0
Author: Claire <[email protected]>
AuthorDate: Thu May 28 11:22:50 2026 +0800

    Support Hive DELETE ORPHAN-FILES Statement about iceberg statement parse 
(#38669)
    
    * support delete orphan files
    
    * update release-notes
    
    * delete blank line
    
    * update
    
    * update test
---
 RELEASE-NOTES.md                                           |  1 +
 .../dialect/hive/src/main/antlr4/imports/hive/BaseRule.g4  |  1 +
 .../hive/src/main/antlr4/imports/hive/DDLStatement.g4      |  6 ++++++
 .../hive/src/main/antlr4/imports/hive/HiveKeyword.g4       |  8 ++++++++
 test/it/parser/src/main/resources/case/ddl/alter-table.xml | 14 +++++++++++++-
 .../src/main/resources/sql/supported/ddl/alter-table.xml   |  3 +++
 6 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 038786d901d..13b8c1a5b63 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -26,6 +26,7 @@
 
 1. Build: Support compiling and using ShardingSphere under OpenJDK 26 - 
[#38625](https://github.com/apache/shardingsphere/issues/38625)
 1. Metadata: Support Oracle dictionary views by adding SYS default system 
schema and YAML definitions - 
[#38388](https://github.com/apache/shardingsphere/pull/38388)
+1. SQL Parser: Support Hive DELETE ORPHAN-FILES Statement about iceberg 
statement parse - [#38669](https://github.com/apache/shardingsphere/pull/38669)
 1. SQL Parser: Support MySQL Function statement parse - 
[#38182](https://github.com/apache/shardingsphere/pull/38182) 
[#38219](https://github.com/apache/shardingsphere/pull/38219)
 1. SQL Parser: Support additional MySQL SELECT index hint and MATCH ... 
AGAINST WITH ROLLUP syntax - 
[#38233](https://github.com/apache/shardingsphere/pull/38233)
 1. SQL Parser: Support MySQL CREATE EVENT and additional CREATE FUNCTION 
RETURN syntax - [#38237](https://github.com/apache/shardingsphere/pull/38237)
diff --git 
a/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/BaseRule.g4 
b/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/BaseRule.g4
index 3ff5612528f..a74fa98036c 100644
--- a/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/BaseRule.g4
+++ b/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/BaseRule.g4
@@ -334,6 +334,7 @@ identifierKeywordsUnambiguous
     | OFFSET
     | OJ
     | OLD
+    | OLDER
     | ONE
     | ONLY
     | OPEN
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 693b69fe2d3..6c07dc9873d 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
@@ -81,6 +81,7 @@ alterTable
     | alterTableCommonClause createTag
     | alterTableCommonClause dropBranch
     | alterTableCommonClause dropTag
+    | alterTableCommonClause deleteOrphanFile
     ;
 
 createView
@@ -534,3 +535,8 @@ dropBranch
 dropTag
     : DROP TAG ifExists? identifier
     ;
+
+deleteOrphanFile
+    : EXECUTE DELETE ORPHAN_FILES
+    | EXECUTE DELETE ORPHAN_FILES OLDER THAN LP_ string_ RP_
+    ;
diff --git 
a/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/HiveKeyword.g4 
b/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/HiveKeyword.g4
index 170f6dd8098..987de893fc8 100644
--- a/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/HiveKeyword.g4
+++ b/parser/sql/engine/dialect/hive/src/main/antlr4/imports/hive/HiveKeyword.g4
@@ -3573,3 +3573,11 @@ AUTOCOMMIT
 VALIDATE
     : V A L I D A T E
     ;
+
+ORPHAN_FILES
+    : O R P H A N '-' F I L E S
+    ;
+
+OLDER
+    : O L D E R
+    ;
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 3ef97b3b21a..ffe04ec2f3c 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
@@ -2520,7 +2520,19 @@
     <alter-table sql-case-id="alter_create_branch_tag">
         <table name="test" start-index="12" stop-index="15" />
     </alter-table>
-    
+
+    <alter-table sql-case-id="alter_delete_orphan_files">
+        <table name="test" start-index="12" stop-index="15" />
+    </alter-table>
+
+    <alter-table sql-case-id="alter_delete_orphan_files_with_date">
+        <table name="test" start-index="12" stop-index="15" />
+    </alter-table>
+
+    <alter-table sql-case-id="alter_with_older_table">
+        <table name="older" start-index="12" stop-index="16" />
+    </alter-table>
+
     <alter-table sql-case-id="alter_create_tag_default">
         <table name="test" start-index="12" stop-index="15" />
     </alter-table>
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 b593c4fb97c..6ca5948a95c 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
@@ -374,6 +374,9 @@
     <sql-case id="alter_drop_branch_if_exists" value="ALTER TABLE test DROP 
BRANCH IF EXISTS branch1;" db-types="Hive" />
     <sql-case id="alter_drop_tag_basic" value="ALTER TABLE test DROP TAG 
tag1;" db-types="Hive" />
     <sql-case id="alter_drop_tag_if_exists" value="ALTER TABLE test DROP TAG 
IF EXISTS tag1;" db-types="Hive" />
+    <sql-case id="alter_delete_orphan_files" value="ALTER TABLE test EXECUTE 
DELETE ORPHAN-FILES;" db-types="Hive" />
+    <sql-case id="alter_delete_orphan_files_with_date" value="ALTER TABLE test 
EXECUTE DELETE ORPHAN-FILES OLDER THAN ('2021-12-09 05:39:18.689000000');" 
db-types="Hive" />
+    <sql-case id="alter_with_older_table" value="ALTER TABLE older EXECUTE 
DELETE ORPHAN-FILES;" db-types="Hive" />
     <sql-case id="alter_table_rename_table_doris" value="ALTER TABLE table1 
RENAME table2" db-types="Doris" />
     <sql-case id="alter_table_without_actions_doris" value="ALTER TABLE 
t_order" db-types="Doris" />
     <sql-case id="alter_table_rename_column_doris" value="ALTER TABLE 
example_table RENAME COLUMN c1 c2" db-types="Doris" />

Reply via email to