You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@impala.apache.org by ta...@apache.org on 2019/11/06 00:22:49 UTC

[impala] branch master updated: IMPALA-8692 Gracefully fail complex type inserts

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

tarmstrong 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 4bffd12  IMPALA-8692 Gracefully fail complex type inserts
4bffd12 is described below

commit 4bffd12b20aa6ddce136f34ad423eb5dd9e4d05f
Author: Abhishek Rawat <ar...@cloudera.com>
AuthorDate: Tue Nov 5 07:28:51 2019 -0800

    IMPALA-8692 Gracefully fail complex type inserts
    
    Impala doesn't support writing new data files containing complex type
    columns. Block such statements during analysis.
    
    Added new tests in AnalyzeStmtsTest for the blocked scenarios.
    
    Change-Id: I81bd04b2f1cd9873462098f67a45cd3974094d96
    Reviewed-on: http://gerrit.cloudera.org:8080/14634
    Reviewed-by: Tim Armstrong <ta...@cloudera.com>
    Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
 fe/src/main/java/org/apache/impala/analysis/InsertStmt.java  |  6 ++++++
 .../java/org/apache/impala/analysis/AnalyzeStmtsTest.java    | 12 ++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/fe/src/main/java/org/apache/impala/analysis/InsertStmt.java b/fe/src/main/java/org/apache/impala/analysis/InsertStmt.java
index 1e7dd6d..eaf1a7b 100644
--- a/fe/src/main/java/org/apache/impala/analysis/InsertStmt.java
+++ b/fe/src/main/java/org/apache/impala/analysis/InsertStmt.java
@@ -451,6 +451,12 @@ public class InsertStmt extends StatementBase {
             "(%s) because the column '%s' has an unsupported type '%s'.",
             getOpName(), targetTableName_, c.getName(), c.getType().toSql()));
       }
+      if (c.getType().isComplexType()) {
+        throw new AnalysisException(String.format("Unable to %s into target table " +
+            "(%s) because the column '%s' has a complex type '%s' and Impala doesn't " +
+            "support inserting into tables containing complex type columns",
+            getOpName(), targetTableName_, c.getName(), c.getType().toSql()));
+      }
     }
 
     // Perform operation-specific analysis.
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 3c4a8c4..d9f9252 100644
--- a/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java
+++ b/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java
@@ -4015,6 +4015,18 @@ public class AnalyzeStmtsTest extends AnalyzerTest {
           "float_col, double_col, date_string_col, string_col, timestamp_col) " +
           "select * from functional.alltypesnopart");
     }
+
+    // Insert into/overwrite a table with complex columns should return error.
+    AnalysisError("insert " + qualifier + " table functional.allcomplextypes" +
+        "(id, year, month) values (57, 2019, 11)",
+        "Unable to INSERT into target table (functional.allcomplextypes) because the " +
+        "column 'int_array_col' has a complex type 'ARRAY<INT>' and Impala doesn't " +
+        "support inserting into tables containing complex type columns");
+    AnalysisError("insert " + qualifier + " table functional.allcomplextypes " +
+        "select * from functional.allcomplextypes",
+        "Unable to INSERT into target table (functional.allcomplextypes) because the " +
+        "column 'int_array_col' has a complex type 'ARRAY<INT>' and Impala doesn't " +
+        "support inserting into tables containing complex type columns");
   }
 
   /**