Allocate buffers when the data empty so that downstream operators do not fail 
in VV transfer


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

Branch: refs/heads/master
Commit: efa3274bdb0b7f91e8b5877a966a22fb4c59dfd8
Parents: 65f6bcb
Author: vkorukanti <[email protected]>
Authored: Fri Jun 20 12:05:05 2014 -0700
Committer: vkorukanti <[email protected]>
Committed: Fri Jun 20 12:05:05 2014 -0700

----------------------------------------------------------------------
 .../org/apache/drill/exec/store/hive/HiveRecordReader.java   | 8 ++++----
 .../java/org/apache/drill/exec/physical/impl/ScanBatch.java  | 2 +-
 2 files changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/efa3274b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveRecordReader.java
----------------------------------------------------------------------
diff --git 
a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveRecordReader.java
 
b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveRecordReader.java
index c062f8c..ddb08c6 100644
--- 
a/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveRecordReader.java
+++ 
b/contrib/storage-hive/core/src/main/java/org/apache/drill/exec/store/hive/HiveRecordReader.java
@@ -247,13 +247,13 @@ public class HiveRecordReader implements RecordReader {
 
   @Override
   public int next() {
-    if (empty) {
-      return 0;
-    }
-
     for (ValueVector vv : vectors) {
       VectorAllocator.getAllocator(vv, FIELD_SIZE).alloc(TARGET_RECORD_COUNT);
     }
+    if (empty) {
+      setValueCountAndPopulatePartitionVectors(0);
+      return 0;
+    }
 
     try {
       int recordCount = 0;

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/efa3274b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java
index 5f8bfb9..f440546 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/ScanBatch.java
@@ -139,7 +139,6 @@ public class ScanBatch implements RecordBatch {
         try {
           if (!readers.hasNext()) {
             currentReader.cleanup();
-            releaseAssets();
             if (first) {
               first = false;
               done = true;
@@ -148,6 +147,7 @@ public class ScanBatch implements RecordBatch {
               schema = container.getSchema();
               return IterOutcome.OK_NEW_SCHEMA;
             }
+            releaseAssets();
             return IterOutcome.NONE;
           }
           oContext.getStats().startSetup();

Reply via email to