Repository: incubator-impala
Updated Branches:
  refs/heads/master 3be0f122a -> 60414f063


IMPALA-4490: Only generate runtime filters for hash join nodes.

Change-Id: I167725e260bd0f91c2bfc164eb044321192d5b95
Reviewed-on: http://gerrit.cloudera.org:8080/5117
Reviewed-by: Alex Behm <[email protected]>
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/263f2225
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/263f2225
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/263f2225

Branch: refs/heads/master
Commit: 263f222557d5931374c2ea453d4c3d9ad1eafa70
Parents: 3be0f12
Author: Alex Behm <[email protected]>
Authored: Wed Nov 16 16:44:52 2016 -0800
Committer: Internal Jenkins <[email protected]>
Committed: Fri Nov 18 00:26:35 2016 +0000

----------------------------------------------------------------------
 .../impala/planner/RuntimeFilterGenerator.java  | 10 +++----
 .../PlannerTest/runtime-filter-propagation.test | 29 ++++++++++++++++++++
 2 files changed, 34 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/263f2225/fe/src/main/java/org/apache/impala/planner/RuntimeFilterGenerator.java
----------------------------------------------------------------------
diff --git 
a/fe/src/main/java/org/apache/impala/planner/RuntimeFilterGenerator.java 
b/fe/src/main/java/org/apache/impala/planner/RuntimeFilterGenerator.java
index c1e67d8..79cd8b8 100644
--- a/fe/src/main/java/org/apache/impala/planner/RuntimeFilterGenerator.java
+++ b/fe/src/main/java/org/apache/impala/planner/RuntimeFilterGenerator.java
@@ -443,13 +443,13 @@ public final class RuntimeFilterGenerator {
   /**
    * Generates the runtime filters for a query by recursively traversing the 
single-node
    * plan tree rooted at 'root'. In the top-down traversal of the plan tree, 
candidate
-   * runtime filters are generated from equi-join predicates. In the bottom-up 
traversal
-   * of the plan tree, the filters are assigned to destination (scan) nodes. 
Filters
-   * that cannot be assigned to a scan node are discarded.
+   * runtime filters are generated from equi-join predicates assigned to 
hash-join nodes.
+   * In the bottom-up traversal of the plan tree, the filters are assigned to 
destination
+   * (scan) nodes. Filters that cannot be assigned to a scan node are 
discarded.
    */
   private void generateFilters(Analyzer analyzer, PlanNode root) {
-    if (root instanceof JoinNode) {
-      JoinNode joinNode = (JoinNode) root;
+    if (root instanceof HashJoinNode) {
+      HashJoinNode joinNode = (HashJoinNode) root;
       List<Expr> joinConjuncts = Lists.newArrayList();
       if (!joinNode.getJoinOp().isLeftOuterJoin()
           && !joinNode.getJoinOp().isFullOuterJoin()

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/263f2225/testdata/workloads/functional-planner/queries/PlannerTest/runtime-filter-propagation.test
----------------------------------------------------------------------
diff --git 
a/testdata/workloads/functional-planner/queries/PlannerTest/runtime-filter-propagation.test
 
b/testdata/workloads/functional-planner/queries/PlannerTest/runtime-filter-propagation.test
index 446aead..be239fe 100644
--- 
a/testdata/workloads/functional-planner/queries/PlannerTest/runtime-filter-propagation.test
+++ 
b/testdata/workloads/functional-planner/queries/PlannerTest/runtime-filter-propagation.test
@@ -1402,3 +1402,32 @@ PLAN-ROOT SINK
 00:SCAN HDFS [functional.alltypes a]
    partitions=24/24 files=24 size=478.45KB
 ====
+# IMPALA-4490: Only generate runtime filters for hash join nodes, even if 
there is an
+# otherwise suitable equality predicate.
+select 1 from functional.alltypes a
+inner join functional.alltypes b
+  on a.id = b.id
+left outer join functional.alltypes c
+  on b.id is distinct from c.id
+where b.int_col + b.bigint_col = c.int_col
+---- PLAN
+PLAN-ROOT SINK
+|
+04:NESTED LOOP JOIN [LEFT OUTER JOIN]
+|  join predicates: b.id IS DISTINCT FROM c.id
+|  predicates: b.int_col + b.bigint_col = c.int_col
+|
+|--02:SCAN HDFS [functional.alltypes c]
+|     partitions=24/24 files=24 size=478.45KB
+|
+03:HASH JOIN [INNER JOIN]
+|  hash predicates: b.id = a.id
+|  runtime filters: RF000 <- a.id
+|
+|--00:SCAN HDFS [functional.alltypes a]
+|     partitions=24/24 files=24 size=478.45KB
+|
+01:SCAN HDFS [functional.alltypes b]
+   partitions=24/24 files=24 size=478.45KB
+   runtime filters: RF000 -> b.id
+====

Reply via email to