Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Drill, mail # dev - [17/17] git commit: DRILL-505: Hash Join


Copy link to this message
-
[17/17] git commit: DRILL-505: Hash Join
jacques@... 2014-04-20, 04:08
DRILL-505: Hash Join

Support for left outer, right outer and full joins

Support for multiple join conditions

Add following tests
 - Multiple condition join
 - Join on JSON scan
 - Multi batch join
 - Simple equality join
Project: http://git-wip-us.apache.org/repos/asf/incubator-drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-drill/commit/1fc7b982
Tree: http://git-wip-us.apache.org/repos/asf/incubator-drill/tree/1fc7b982
Diff: http://git-wip-us.apache.org/repos/asf/incubator-drill/diff/1fc7b982

Branch: refs/heads/master
Commit: 1fc7b982414bc0dcd29b1d31e312d2207971933a
Parents: c7cb7ba
Author: Mehant Baid <[EMAIL PROTECTED]>
Authored: Tue Feb 25 01:09:06 2014 -0800
Committer: Jacques Nadeau <[EMAIL PROTECTED]>
Committed: Sat Apr 19 21:07:29 2014 -0700

 .../physical/base/AbstractPhysicalVisitor.java  |   5 +
 .../exec/physical/base/PhysicalVisitor.java     |   1 +
 .../drill/exec/physical/config/HashJoinPOP.java | 143 ++++++++
 .../physical/impl/common/ChainedHashTable.java  |  40 ++-
 .../exec/physical/impl/common/HashTable.java    |   2 +-
 .../physical/impl/common/HashTableTemplate.java |  11 +-
 .../exec/physical/impl/join/HashJoinBatch.java  | 355 +++++++++++++++++++
 .../impl/join/HashJoinBatchCreator.java         |  37 ++
 .../exec/physical/impl/join/HashJoinHelper.java | 222 ++++++++++++
 .../exec/physical/impl/join/HashJoinProbe.java  |  56 +++
 .../impl/join/HashJoinProbeTemplate.java        | 226 ++++++++++++
 .../exec/physical/impl/join/TestHashJoin.java   | 216 +++++++++++
 .../apache/drill/exec/pop/PopUnitTestBase.java  |   2 +-
 .../src/test/resources/build_side_input.json    |  24 ++
 .../src/test/resources/join/hash_join.json      |  63 ++++
 .../resources/join/hash_join_multi_batch.json   |  47 +++
 .../join/hj_left_outer_multi_batch.json         |  48 +++
 .../resources/join/hj_multi_condition_join.json |  66 ++++
 .../join/hj_right_outer_multi_batch.json        |  48 +++
 .../src/test/resources/probe_side_input.json    |  28 ++
 20 files changed, 1618 insertions(+), 22 deletions(-)
http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1fc7b982/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractPhysicalVisitor.java
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractPhysicalVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractPhysicalVisitor.java
index 5f37487..abafc42 100644
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/AbstractPhysicalVisitor.java
@@ -106,6 +106,11 @@ public abstract class AbstractPhysicalVisitor<T, X, E extends Throwable> impleme
   }
 
   @Override
+  public T visitHashJoin(HashJoinPOP join, X value) throws E {
+    return visitOp(join, value);
+  }
+
+  @Override
   public T visitHashPartitionSender(HashPartitionSender op, X value) throws E {
     return visitSender(op, value);
   }

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1fc7b982/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalVisitor.java
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalVisitor.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalVisitor.java
index 712fafe..208dab9 100644
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/base/PhysicalVisitor.java
@@ -41,6 +41,7 @@ public interface PhysicalVisitor<RETURN, EXTRA, EXCEP extends Throwable> {
   public RETURN visitSort(Sort sort, EXTRA value) throws EXCEP;
   public RETURN visitLimit(Limit limit, EXTRA value) throws EXCEP;
   public RETURN visitMergeJoin(MergeJoinPOP join, EXTRA value) throws EXCEP;
+  public RETURN visitHashJoin(HashJoinPOP join, EXTRA value) throws EXCEP;
   public RETURN visitSender(Sender sender, EXTRA value) throws EXCEP;
   public RETURN visitReceiver(Receiver receiver, EXTRA value) throws EXCEP;
   public RETURN visitStreamingAggregate(StreamingAggregate agg, EXTRA value) throws EXCEP;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/1fc7b982/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashJoinPOP.java
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashJoinPOP.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashJoinPOP.java
new file mode 100644
index 0000000..f4a1fc7
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/config/HashJoinPOP.java
@@ -0,0 +1,143 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.drill.exec.physical.config;
+
+import com.fasterxml.jackson.annotation.JsonTypeName;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.drill.common.expression.FieldReference;
+import org.apache.drill.common.logical.data.JoinCondition;
+import org.apache.drill.common.logical.data.NamedExpression;
+import org.apache.drill.exec.physical.OperatorCost;
+import org.apache.drill.exec.physical.base.AbstractBase;
+import org.apache.drill.exec.physical.base.PhysicalOperator;
+import org.apache.drill.exec.physical.base.PhysicalVisitor;
+import org.apache.drill.exec.physical.base.Size;
+
+import com.beust.jcommander.internal.Lists;
+import c