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

joemcdonnell 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 87b95a5  IMPALA-10386: Don't allow PARTITION BY SPEC for non-Iceberg 
tables
87b95a5 is described below

commit 87b95a55688dc0631b27db7306b2939ddafcba7e
Author: Zoltan Borok-Nagy <borokna...@cloudera.com>
AuthorDate: Wed Dec 9 15:11:22 2020 +0100

    IMPALA-10386: Don't allow PARTITION BY SPEC for non-Iceberg tables
    
    PARTITION BY SPEC is only valid for Iceberg tables so Impala should
    raise an error when it is used for non-Iceberg tables.
    
    Testing
     * added e2e test
    
    Change-Id: I6b3ec3e84476614cb11e801b6d89d84eb384dd43
    Reviewed-on: http://gerrit.cloudera.org:8080/16846
    Reviewed-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
    Tested-by: Impala Public Jenkins <impala-public-jenk...@cloudera.com>
---
 fe/src/main/java/org/apache/impala/analysis/CreateTableStmt.java    | 6 ++++++
 .../functional-query/queries/QueryTest/iceberg-negative.test        | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/fe/src/main/java/org/apache/impala/analysis/CreateTableStmt.java 
b/fe/src/main/java/org/apache/impala/analysis/CreateTableStmt.java
index 299478c..ab378c7 100644
--- a/fe/src/main/java/org/apache/impala/analysis/CreateTableStmt.java
+++ b/fe/src/main/java/org/apache/impala/analysis/CreateTableStmt.java
@@ -272,6 +272,12 @@ public class CreateTableStmt extends StatementBase {
 
     if (getFileFormat() == THdfsFileFormat.ICEBERG) {
       analyzeIcebergFormat(analyzer);
+    } else {
+      List<IcebergPartitionSpec> iceSpec = 
tableDef_.getIcebergPartitionSpecs();
+      if (iceSpec != null && !iceSpec.isEmpty()) {
+        throw new AnalysisException(
+            "PARTITION BY SPEC is only valid for Iceberg tables.");
+      }
     }
 
     // If lineage logging is enabled, compute minimal lineage graph.
diff --git 
a/testdata/workloads/functional-query/queries/QueryTest/iceberg-negative.test 
b/testdata/workloads/functional-query/queries/QueryTest/iceberg-negative.test
index d758bb0..b03b0f2 100644
--- 
a/testdata/workloads/functional-query/queries/QueryTest/iceberg-negative.test
+++ 
b/testdata/workloads/functional-query/queries/QueryTest/iceberg-negative.test
@@ -19,6 +19,12 @@ STORED AS ICEBERG;
 AnalysisException: Cannot find source column: event_time
 ====
 ---- QUERY
+CREATE TABLE non_iceberg_table_with_spec (i INT)
+PARTITION BY SPEC (i identity);
+---- CATCH
+AnalysisException: PARTITION BY SPEC is only valid for Iceberg tables.
+====
+---- QUERY
 CREATE TABLE iceberg_table_hadoop_tables(
   level STRING
 )

Reply via email to