You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by bo...@apache.org on 2022/05/12 15:47:35 UTC

[impala] branch master updated: IMPALA-11287 (part 1): Disable CREATE TABLE LIKE statements for Iceberg tables

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 7c40b95a0 IMPALA-11287 (part 1): Disable CREATE TABLE LIKE statements for Iceberg tables
7c40b95a0 is described below

commit 7c40b95a04601c04527770bb42bbfdd37d9109c0
Author: Zoltan Borok-Nagy <bo...@cloudera.com>
AuthorDate: Wed May 11 17:51:10 2022 +0200

    IMPALA-11287 (part 1): Disable CREATE TABLE LIKE statements for Iceberg tables
    
    We currently don't implement correct behavior for CREATE TABLE LIKE
    statements for Iceberg tables. Neither on the source, nor on the
    target table side.
    
    This patch forbids such statements until they are correctly implemented.
    
    Testing
     * added e2e test
    
    Change-Id: I9cee6fc82547dabf63937cc541163c1ee59a4013
    Reviewed-on: http://gerrit.cloudera.org:8080/18517
    Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 .../java/org/apache/impala/analysis/CreateTableLikeStmt.java  | 11 +++++++++++
 .../functional-query/queries/QueryTest/iceberg-negative.test  | 10 ++++++++++
 2 files changed, 21 insertions(+)

diff --git a/fe/src/main/java/org/apache/impala/analysis/CreateTableLikeStmt.java b/fe/src/main/java/org/apache/impala/analysis/CreateTableLikeStmt.java
index 2dafe6c4c..29dd4c60d 100644
--- a/fe/src/main/java/org/apache/impala/analysis/CreateTableLikeStmt.java
+++ b/fe/src/main/java/org/apache/impala/analysis/CreateTableLikeStmt.java
@@ -22,6 +22,7 @@ import java.util.List;
 import org.apache.hadoop.fs.permission.FsAction;
 import org.apache.impala.authorization.Privilege;
 import org.apache.impala.catalog.FeTable;
+import org.apache.impala.catalog.IcebergTable;
 import org.apache.impala.catalog.KuduTable;
 import org.apache.impala.common.AnalysisException;
 import org.apache.impala.common.Pair;
@@ -170,6 +171,12 @@ public class CreateTableLikeStmt extends StatementBase {
     if (fileFormat_ == THdfsFileFormat.KUDU) {
       throw new AnalysisException("CREATE TABLE LIKE is not supported for Kudu tables");
     }
+    // We currently don't support creating an Iceberg table using a CREATE TABLE LIKE
+    // statement (see IMPALA-11287).
+    if (fileFormat_ == THdfsFileFormat.ICEBERG) {
+      throw new AnalysisException(
+          "CREATE TABLE LIKE is not supported for Iceberg tables.");
+    }
 
     // Make sure the source table exists and the user has permission to access it.
     FeTable srcTable = analyzer.getTable(srcTableName_, Privilege.VIEW_METADATA);
@@ -180,6 +187,10 @@ public class CreateTableLikeStmt extends StatementBase {
       throw new AnalysisException("Cloning a Kudu table using CREATE TABLE LIKE is " +
           "not supported.");
     }
+    if (IcebergTable.isIcebergTable(srcTable.getMetaStoreTable())) {
+      throw new AnalysisException("Cloning an Iceberg table using CREATE TABLE LIKE is " +
+          "not supported.");
+    }
     srcDbName_ = srcTable.getDb().getName();
     analyzer.getFqTableName(tableName_).analyze();
     dbName_ = analyzer.getTargetDbName(tableName_);
diff --git a/testdata/workloads/functional-query/queries/QueryTest/iceberg-negative.test b/testdata/workloads/functional-query/queries/QueryTest/iceberg-negative.test
index 69b0d67d8..0a3555f51 100644
--- a/testdata/workloads/functional-query/queries/QueryTest/iceberg-negative.test
+++ b/testdata/workloads/functional-query/queries/QueryTest/iceberg-negative.test
@@ -602,3 +602,13 @@ select * from functional_parquet.iceberg_v2_delete_positional;
 ---- CATCH
 row_regex:.*CAUSED BY: TableLoadingException: Unsupported Iceberg V2 feature, table .* contains delete files..*
 ====
+---- QUERY
+CREATE TABLE ice_clone LIKE functional_parquet.iceberg_non_partitioned;
+---- CATCH
+Cloning an Iceberg table using CREATE TABLE LIKE is not supported.
+====
+---- QUERY
+CREATE TABLE clone_ice LIKE functional_parquet.alltypestiny STORED AS ICEBERG;
+---- CATCH
+CREATE TABLE LIKE is not supported for Iceberg tables.
+====