impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tarmstr...@apache.org
Subject [3/3] incubator-impala git commit: IMPALA-4662: Fix NULL literal handling in Kudu IN list predicates
Date Thu, 15 Dec 2016 23:03:33 GMT
IMPALA-4662: Fix NULL literal handling in Kudu IN list predicates

The KuduScanNode attempts to push IN list predicates to the
Kudu scan, but NULL literals cannot be pushed. The code in
KuduScanNode needed to check if the Literals in the
InPredicate is a NullLiteral, in which case the entire IN
list should not be pushed to Kudu.

The same handling is already in place for binary predicate
pushdown.

Change-Id: Iaf2c10a326373ad80aef51a85cec64071daefa7b
Reviewed-on: http://gerrit.cloudera.org:8080/5505
Reviewed-by: Michael Brown <mikeb@cloudera.com>
Reviewed-by: Matthew Jacobs <mj@cloudera.com>
Tested-by: Internal Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/c2faf4a8
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/c2faf4a8
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/c2faf4a8

Branch: refs/heads/master
Commit: c2faf4a8a13ba89f2f4f2bc4fbd878cffda53d1f
Parents: 54194af
Author: Matthew Jacobs <mj@cloudera.com>
Authored: Wed Dec 14 15:58:59 2016 -0800
Committer: Internal Jenkins <cloudera-hudson@gerrit.cloudera.org>
Committed: Thu Dec 15 23:00:24 2016 +0000

----------------------------------------------------------------------
 .../java/org/apache/impala/planner/KuduScanNode.java    | 11 ++++++++---
 .../functional-planner/queries/PlannerTest/kudu.test    | 12 ++++++++++++
 2 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/c2faf4a8/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
----------------------------------------------------------------------
diff --git a/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java b/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
index 580f5e0..cdb620c 100644
--- a/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
@@ -309,7 +309,7 @@ public class KuduScanNode extends ScanNode {
     SlotRef ref = (SlotRef) predicate.getChild(0);
     LiteralExpr literal = (LiteralExpr) predicate.getChild(1);
 
-    // Cannot push prediates with null literal values (KUDU-1595).
+    // Cannot push predicates with null literal values (KUDU-1595).
     if (literal instanceof NullLiteral) return false;
 
     String colName = ref.getDesc().getColumn().getName();
@@ -379,8 +379,13 @@ public class KuduScanNode extends ScanNode {
     List<Object> values = Lists.newArrayList();
     for (int i = 1; i < predicate.getChildren().size(); ++i) {
       if (!(predicate.getChild(i).isLiteral())) return false;
-      Object value = getKuduInListValue((LiteralExpr) predicate.getChild(i));
-      Preconditions.checkNotNull(value == null);
+      LiteralExpr literal = (LiteralExpr) predicate.getChild(i);
+
+      // Cannot push predicates with null literal values (KUDU-1595).
+      if (literal instanceof NullLiteral) return false;
+
+      Object value = getKuduInListValue(literal);
+      Preconditions.checkNotNull(value);
       values.add(value);
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/c2faf4a8/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
----------------------------------------------------------------------
diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test b/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
index 776882d..9f2270f 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
@@ -314,3 +314,15 @@ PLAN-ROOT SINK
    predicates: CAST(a.id AS STRING) > '123'
    kudu predicates: a.id > 10
 ====
+# IMPALA-4662: Kudu analysis failure for NULL literal in IN list
+# NULL literal in values list results in applying predicate at scan node
+select id from functional_kudu.alltypestiny where
+id in (1, null) and string_col in (null) and bool_col in (null) and double_col in (null)
+and float_col in (null) and tinyint_col in (null) and smallint_col in (null) and
+bigint_col in (null)
+---- PLAN
+PLAN-ROOT SINK
+|
+00:SCAN KUDU [functional_kudu.alltypestiny]
+   predicates: id IN (1, NULL), bigint_col IN (NULL), bool_col IN (NULL), double_col IN (NULL),
float_col IN (NULL), smallint_col IN (NULL), string_col IN (NULL), tinyint_col IN (NULL)
+====


Mime
View raw message