drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s..@apache.org
Subject [1/2] drill git commit: DRILL-3088: Kill and cleanup remaing batches in left upstream in NestedLoopJoin
Date Fri, 15 May 2015 00:20:15 GMT
Repository: drill
Updated Branches:
  refs/heads/master f7f6efc52 -> 16ef62851


DRILL-3088: Kill and cleanup remaing batches in left upstream in NestedLoopJoin


Project: http://git-wip-us.apache.org/repos/asf/drill/repo
Commit: http://git-wip-us.apache.org/repos/asf/drill/commit/80e3f74f
Tree: http://git-wip-us.apache.org/repos/asf/drill/tree/80e3f74f
Diff: http://git-wip-us.apache.org/repos/asf/drill/diff/80e3f74f

Branch: refs/heads/master
Commit: 80e3f74f3951d84c3209e6910440f2b0378cbd6f
Parents: f7f6efc
Author: Steven Phillips <smp@apache.org>
Authored: Thu May 14 15:44:52 2015 -0700
Committer: Steven Phillips <smp@apache.org>
Committed: Thu May 14 15:48:17 2015 -0700

----------------------------------------------------------------------
 .../physical/impl/join/NestedLoopJoinBatch.java | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/drill/blob/80e3f74f/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/NestedLoopJoinBatch.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/NestedLoopJoinBatch.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/NestedLoopJoinBatch.java
index de0d8e5..9bcea60 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/NestedLoopJoinBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/join/NestedLoopJoinBatch.java
@@ -39,6 +39,7 @@ import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.RecordBatch;
 import org.apache.drill.exec.record.TypedFieldId;
 import org.apache.drill.exec.record.VectorWrapper;
+import org.apache.drill.exec.server.options.DrillConfigIterator.Iter;
 import org.apache.drill.exec.vector.AllocationHelper;
 
 import com.google.common.base.Preconditions;
@@ -143,6 +144,8 @@ public class NestedLoopJoinBatch extends AbstractRecordBatch<NestedLoopJoinPOP>
 
       // exit if we have an empty left batch
       if (leftUpstream == IterOutcome.NONE) {
+        // inform upstream that we don't need anymore data and make sure we clean up any
batches already in queue
+        killAndDrainRight();
         return IterOutcome.NONE;
       }
 
@@ -193,6 +196,23 @@ public class NestedLoopJoinBatch extends AbstractRecordBatch<NestedLoopJoinPOP>
     return (outputRecords > 0) ? IterOutcome.OK : IterOutcome.NONE;
   }
 
+  private void killAndDrainRight() {
+    if (!hasMore(rightUpstream)) {
+      return;
+    }
+    right.kill(true);
+    while (hasMore(rightUpstream)) {
+      for (VectorWrapper<?> wrapper : right) {
+        wrapper.getValueVector().clear();
+      }
+      rightUpstream = next(HashJoinHelper.RIGHT_INPUT, right);
+    }
+  }
+
+  private boolean hasMore(IterOutcome outcome) {
+    return outcome == IterOutcome.OK || outcome == IterOutcome.OK_NEW_SCHEMA;
+  }
+
   /**
    * Method generates the runtime code needed for NLJ. Other than the setup method to set
the input and output value
    * vector references we implement two more methods


Mime
View raw message