You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@drill.apache.org by ti...@apache.org on 2018/09/21 21:56:44 UTC

[drill] branch master updated: DRILL-6747:

This is an automated email from the ASF dual-hosted git repository.

timothyfarkas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git


The following commit(s) were added to refs/heads/master by this push:
     new 87ed03f  DRILL-6747:
87ed03f is described below

commit 87ed03f43f836f44dd375b09d7b1a5adf588b0c1
Author: Timothy Farkas <ti...@apache.org>
AuthorDate: Wed Sep 19 13:23:32 2018 -0700

    DRILL-6747:
    
     - Fixed IOB in HashJoin for inner and right joins on empty probe side.
     - Documentated expected behavior of RecordBatch after returning NONE.
     - Made UnorderedReceiver obey contract after returning NONE.
---
 .../physical/impl/unorderedreceiver/UnorderedReceiverBatch.java   | 2 +-
 .../src/main/java/org/apache/drill/exec/record/RecordBatch.java   | 8 ++++++++
 .../main/java/org/apache/drill/exec/record/RecordBatchLoader.java | 8 ++++++++
 3 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverBatch.java
index 424a733..8cdc0a1 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/unorderedreceiver/UnorderedReceiverBatch.java
@@ -174,7 +174,7 @@ public class UnorderedReceiverBatch implements CloseableRecordBatch {
       first = false;
 
       if (batch == null) {
-        batchLoader.clear();
+        batchLoader.zero();
         if (!context.getExecutorState().shouldContinue()) {
           return IterOutcome.STOP;
         }
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java
index b44a362..c65827c 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatch.java
@@ -115,6 +115,14 @@ public interface RecordBatch extends VectorAccessible {
      *   This value will be returned only after {@link #OK_NEW_SCHEMA} has been
      *   returned at least once (not necessarily <em>immediately</em> after).
      * </p>
+     * <p>
+     *   Also after a RecordBatch returns NONE a RecordBatch should:
+     *   <ul>
+     *     <li>Contain the last valid schema seen by the operator.</li>
+     *     <li>Contain a VectorContainer with empty columns corresponding to the last valid schema.</li>
+     *     <li>Return a record count of 0.</li>
+     *   </ul>
+     * </p>
      */
     NONE(false),
 
diff --git a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatchLoader.java b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatchLoader.java
index bea7cb5..e841f2f 100644
--- a/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatchLoader.java
+++ b/exec/java-exec/src/main/java/org/apache/drill/exec/record/RecordBatchLoader.java
@@ -277,6 +277,14 @@ public class RecordBatchLoader implements VectorAccessible, Iterable<VectorWrapp
   public void resetRecordCount() { valueCount = 0; }
 
   /**
+   * Removes an data from the loader, but maintains the schema and empty vectors.
+   */
+  public void zero() {
+    container.zeroVectors();
+    resetRecordCount();
+  }
+
+  /**
    * Clears this loader, which clears the internal vector container (see
    * {@link VectorContainer#clear}) and resets the record count to zero.
    */