Repository: incubator-drill
Updated Branches:
  refs/heads/master 2fad21d5a -> f7688be48


DRILL-789: Left outer join returns "null" values for columns from the right 
table

The problem is that the "lastSet" field is not set on the Nullable mutator when 
the vector is loaded off the wire. The fix here is to make sure this gets set.

At the same time, this wouldn't be a problem, except for the fact that we fill 
in empty values when setValueCount is called, and if "lastSet" is not correct, 
we end up clobbering the existing data. We shouldn't need to call setValueCount 
on a transferred vector, so I am making this change in project record batch.


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

Branch: refs/heads/master
Commit: 0f8be869f67a2c76b3550d7ee6b58fb13225e227
Parents: 2fad21d
Author: Steven Phillips <[email protected]>
Authored: Wed May 21 17:57:38 2014 -0700
Committer: Steven Phillips <[email protected]>
Committed: Wed May 21 17:57:38 2014 -0700

----------------------------------------------------------------------
 .../main/codegen/templates/FixedValueVectors.java   |  3 +++
 .../codegen/templates/NullableValueVectors.java     |  1 +
 .../physical/impl/project/ProjectRecordBatch.java   | 16 ++++++++--------
 3 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/0f8be869/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java 
b/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
index ca96e32..46e3c59 100644
--- a/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/FixedValueVectors.java
@@ -126,6 +126,7 @@ public final class ${minor.class}Vector extends 
BaseDataValueVector implements F
     int len = valueCount * ${type.width};
     data = buf.slice(0, len);
     data.retain();
+    data.writerIndex(len);
     return len;
   }
   
@@ -150,6 +151,7 @@ public final class ${minor.class}Vector extends 
BaseDataValueVector implements F
   public void transferTo(${minor.class}Vector target){
     target.data = data;
     target.data.retain();
+    target.data.writerIndex(data.writerIndex());
     target.valueCount = valueCount;
     clear();
   }
@@ -159,6 +161,7 @@ public final class ${minor.class}Vector extends 
BaseDataValueVector implements F
     int startPoint = startIndex * ${type.width};
     int sliceLength = length * ${type.width};
     target.data = this.data.slice(startPoint, sliceLength);
+    target.data.writerIndex(sliceLength);
     target.data.retain();
   }
   

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/0f8be869/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java 
b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
index 7cece65..29cd7cc 100644
--- a/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
+++ b/exec/java-exec/src/main/codegen/templates/NullableValueVectors.java
@@ -127,6 +127,7 @@ public final class ${className} extends BaseValueVector 
implements <#if type.maj
     buf = buf.slice(loaded, buf.capacity() - loaded);
     dataBytes -= loaded;
     loaded += values.load(dataBytes, valueCount, buf);
+    this.mutator.lastSet = valueCount;
     return loaded;
   }
   

http://git-wip-us.apache.org/repos/asf/incubator-drill/blob/0f8be869/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
----------------------------------------------------------------------
diff --git 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
index fe19797..27f26fd 100644
--- 
a/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
+++ 
b/exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/project/ProjectRecordBatch.java
@@ -93,16 +93,16 @@ public class ProjectRecordBatch extends 
AbstractSingleRecordBatch<Project>{
     }
     int outputRecords = projector.projectRecords(0, incomingRecordCount, 0);
     if (outputRecords < incomingRecordCount) {
-      for(VectorWrapper<?> v : container){
-        ValueVector.Mutator m = v.getValueVector().getMutator();
+      for(ValueVector v : allocationVectors){
+        ValueVector.Mutator m = v.getMutator();
         m.setValueCount(outputRecords);
       }
       hasRemainder = true;
       remainderIndex = outputRecords;
       this.recordCount = remainderIndex;
     } else {
-      for(VectorWrapper<?> v : container){
-        ValueVector.Mutator m = v.getValueVector().getMutator();
+      for(ValueVector v : allocationVectors){
+        ValueVector.Mutator m = v.getMutator();
         m.setValueCount(incomingRecordCount);
       }
       for(VectorWrapper<?> v: incoming) {
@@ -119,16 +119,16 @@ public class ProjectRecordBatch extends 
AbstractSingleRecordBatch<Project>{
     }
     int outputIndex = projector.projectRecords(remainderIndex, 
remainingRecordCount, 0);
     if (outputIndex < incoming.getRecordCount()) {
-      for(VectorWrapper<?> v : container){
-        ValueVector.Mutator m = v.getValueVector().getMutator();
+      for(ValueVector v : allocationVectors){
+        ValueVector.Mutator m = v.getMutator();
         m.setValueCount(outputIndex - remainderIndex);
       }
       hasRemainder = true;
       this.recordCount = outputIndex - remainderIndex;
       remainderIndex = outputIndex;
     } else {
-      for(VectorWrapper<?> v : container){
-        ValueVector.Mutator m = v.getValueVector().getMutator();
+      for(ValueVector v : allocationVectors){
+        ValueVector.Mutator m = v.getMutator();
         m.setValueCount(remainingRecordCount);
       }
       hasRemainder = false;

Reply via email to