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. +====