You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ja...@apache.org on 2026/06/05 21:17:41 UTC

(impala) 01/03: IMPALA-15071: Allow setting format-version=3 in ALTER TABLE CONVERT TO

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

asf-gitbox-commits pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/impala.git

commit be072442b6fea4bba0a15db64a86f987ef2a355c
Author: Zoltan Borok-Nagy <bo...@cloudera.com>
AuthorDate: Thu Jun 4 17:16:26 2026 +0200

    IMPALA-15071: Allow setting format-version=3 in ALTER TABLE CONVERT TO
    
    We should allow setting format-version=3 in ALTER TABLE CONVERT TO
    now that we are supporting Iceberg V3 tables.
    
    Iceberg V4 is still rejected by Impala (Iceberg library would allow it).
    
    Testing
    * unit test
    * e2e test
    
    Change-Id: Id7222888ae7ca21139b3df92600c7465903dc83f
    Reviewed-on: http://gerrit.cloudera.org:8080/24397
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 .../apache/impala/analysis/ConvertTableToIcebergStmt.java   |  3 ++-
 .../main/java/org/apache/impala/catalog/IcebergTable.java   |  1 +
 .../java/org/apache/impala/analysis/AnalyzeStmtsTest.java   |  6 ++++--
 .../iceberg-migrate-from-external-hdfs-tables.test          | 13 ++++++++++---
 4 files changed, 17 insertions(+), 6 deletions(-)

diff --git a/fe/src/main/java/org/apache/impala/analysis/ConvertTableToIcebergStmt.java b/fe/src/main/java/org/apache/impala/analysis/ConvertTableToIcebergStmt.java
index 998db8a36..cb2680107 100644
--- a/fe/src/main/java/org/apache/impala/analysis/ConvertTableToIcebergStmt.java
+++ b/fe/src/main/java/org/apache/impala/analysis/ConvertTableToIcebergStmt.java
@@ -142,7 +142,8 @@ public class ConvertTableToIcebergStmt extends StatementBase implements SingleTa
         try {
           int formatVersion = Integer.parseInt(value);
           if (formatVersion == IcebergTable.ICEBERG_FORMAT_V1
-              || formatVersion == IcebergTable.ICEBERG_FORMAT_V2) {
+              || formatVersion == IcebergTable.ICEBERG_FORMAT_V2
+              || formatVersion == IcebergTable.ICEBERG_FORMAT_V3) {
             continue;
           }
           throw new AnalysisException(
diff --git a/fe/src/main/java/org/apache/impala/catalog/IcebergTable.java b/fe/src/main/java/org/apache/impala/catalog/IcebergTable.java
index 583e57835..dbfc46c10 100644
--- a/fe/src/main/java/org/apache/impala/catalog/IcebergTable.java
+++ b/fe/src/main/java/org/apache/impala/catalog/IcebergTable.java
@@ -115,6 +115,7 @@ public class IcebergTable extends Table implements FeIcebergTable {
   // Iceberg format version numbers
   public static final int ICEBERG_FORMAT_V1 = 1;
   public static final int ICEBERG_FORMAT_V2 = 2;
+  public static final int ICEBERG_FORMAT_V3 = 3;
 
   // Iceberg table catalog location key in tblproperties when using HadoopCatalog
   // This property is necessary for both managed and external Iceberg table with
diff --git a/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java b/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java
index 72dff4061..d3cf12437 100644
--- a/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java
+++ b/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java
@@ -5333,9 +5333,11 @@ public class AnalyzeStmtsTest extends AnalyzerTest {
         + " tblproperties('format-version'='1')");
     AnalyzesOk("alter table functional_parquet.tinytable convert to iceberg"
         + " tblproperties('format-version'='2')");
+    AnalyzesOk("alter table functional_parquet.tinytable convert to iceberg"
+            + " tblproperties('format-version'='3')");
     AnalysisError("alter table functional_parquet.tinytable convert to iceberg"
-            + " tblproperties('format-version'='3')",
-        "Unsupported Iceberg format version '3'");
+            + " tblproperties('format-version'='4')",
+        "Unsupported Iceberg format version '4'");
     AnalysisError("alter table functional_parquet.tinytable convert to iceberg"
             + " tblproperties('format-version'='unknown')",
         "Invalid Iceberg format version 'unknown'");
diff --git a/testdata/workloads/functional-query/queries/QueryTest/iceberg-migrate-from-external-hdfs-tables.test b/testdata/workloads/functional-query/queries/QueryTest/iceberg-migrate-from-external-hdfs-tables.test
index 671a91355..e77a9b094 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/iceberg-migrate-from-external-hdfs-tables.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/iceberg-migrate-from-external-hdfs-tables.test
@@ -323,11 +323,18 @@ describe formatted converted_into_v1;
 string, string, string
 ====
 ---- QUERY
-# Currently not feasible to convert directly into a V3 Iceberg table.
+# Convert to Iceberg V3.
 create table converted_into_v3 (i int) partitioned by (s string) stored as parquet;
 alter table converted_into_v3 convert to iceberg tblproperties ('format-version'='3');
----- CATCH
-AnalysisException: Unsupported Iceberg format version '3'.
+---- RESULTS
+'Table has been migrated.'
+====
+---- QUERY
+describe formatted converted_into_v3;
+---- RESULTS: VERIFY_IS_SUBSET
+'','format-version      ','3                   '
+---- TYPES
+string, string, string
 ====
 ---- QUERY
 create table simple_tbl (i int) stored as parquet;