impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From k...@apache.org
Subject [4/8] incubator-impala git commit: IMPALA-4578: Pick up bound predicates for Kudu scan nodes.
Date Tue, 06 Dec 2016 19:07:32 GMT
IMPALA-4578: Pick up bound predicates for Kudu scan nodes.

The bug was a simple oversight. In KuduScanNiode.init()
we forgot to call Analyzer.getBoundPredicates().

Change-Id: I19a38d6ea8cc0d2b0ddc3808d1f9ffef5ce306a8
Reviewed-on: http://gerrit.cloudera.org:8080/5365
Reviewed-by: Alex Behm <alex.behm@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/b656f570
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/b656f570
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/b656f570

Branch: refs/heads/master
Commit: b656f570e9d395129b820506a5e92ffb92b452f4
Parents: 5bb9959
Author: Alex Behm <alex.behm@cloudera.com>
Authored: Mon Dec 5 13:43:36 2016 -0800
Committer: Internal Jenkins <cloudera-hudson@gerrit.cloudera.org>
Committed: Tue Dec 6 06:19:03 2016 +0000

----------------------------------------------------------------------
 .../org/apache/impala/planner/KuduScanNode.java | 10 +++++-
 .../queries/PlannerTest/kudu.test               | 33 ++++++++++++++++++++
 2 files changed, 42 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/b656f570/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 04fb244..580f5e0 100644
--- a/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
+++ b/fe/src/main/java/org/apache/impala/planner/KuduScanNode.java
@@ -102,8 +102,16 @@ public class KuduScanNode extends ScanNode {
 
   @Override
   public void init(Analyzer analyzer) throws ImpalaRuntimeException {
-    assignConjuncts(analyzer);
+    conjuncts_.clear();
+    // Add bound predicates.
+    conjuncts_.addAll(analyzer.getBoundPredicates(desc_.getId()));
+    // Add unassigned predicates.
+    List<Expr> unassigned = analyzer.getUnassignedConjuncts(this);
+    conjuncts_.addAll(unassigned);
+    analyzer.markConjunctsAssigned(unassigned);
+    // Add equivalence predicates.
     analyzer.createEquivConjuncts(tupleIds_.get(0), conjuncts_);
+    Expr.removeDuplicates(conjuncts_);
     conjuncts_ = orderConjunctsByCost(conjuncts_);
 
     try (KuduClient client = KuduUtil.createKuduClient(kuduTable_.getKuduMasterHosts()))
{

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/b656f570/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 fa54ace..776882d 100644
--- a/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
+++ b/testdata/workloads/functional-planner/queries/PlannerTest/kudu.test
@@ -281,3 +281,36 @@ PLAN-ROOT SINK
 00:SCAN KUDU [functional_kudu.alltypes]
    kudu predicates: bool_col = FALSE
 ====
+# IMPALA-4578: Test predicate propagation for Kudu scans.
+select /* +straight_join */ count(*)
+from functional_kudu.alltypes a
+inner join functional_kudu.alltypessmall b
+  on a.id = b.id
+left outer join functional_kudu.alltypestiny c
+  on b.int_col = c.int_col
+where a.id > 10 and c.int_col > 20
+  and cast(b.id as string) > '123'
+---- PLAN
+PLAN-ROOT SINK
+|
+05:AGGREGATE [FINALIZE]
+|  output: count(*)
+|
+04:HASH JOIN [LEFT OUTER JOIN]
+|  hash predicates: b.int_col = c.int_col
+|  other predicates: c.int_col > 20
+|
+|--02:SCAN KUDU [functional_kudu.alltypestiny c]
+|     kudu predicates: c.int_col > 20
+|
+03:HASH JOIN [INNER JOIN]
+|  hash predicates: a.id = b.id
+|
+|--01:SCAN KUDU [functional_kudu.alltypessmall b]
+|     predicates: CAST(b.id AS STRING) > '123'
+|     kudu predicates: b.id > 10
+|
+00:SCAN KUDU [functional_kudu.alltypes a]
+   predicates: CAST(a.id AS STRING) > '123'
+   kudu predicates: a.id > 10
+====


Mime
View raw message