paul-rogers commented on a change in pull request #1896: DRILL-7441: Fix issues 
with fillEmpties, offset vectors
URL: https://github.com/apache/drill/pull/1896#discussion_r347010087
 
 

 ##########
 File path: exec/vector/src/main/codegen/templates/NullableValueVectors.java
 ##########
 @@ -844,29 +841,35 @@ public void generateTestData(int valueCount) {
 
     @Override
     public void reset() {
-      setCount = 0;
       <#if type.major = "VarLen">lastSet = -1;</#if>
     }
 
     <#if type.major = "VarLen">
     @VisibleForTesting
     public int getLastSet() { return lastSet; }
-    
+
     </#if>
+    @Override
+    public void setSetCount(int n) {
+      <#if type.major = "VarLen">lastSet = n - 1;</#if>
+    }
+    
     // For nullable vectors, exchanging buffers (done elsewhere)
     // requires also exchanging mutator state (done here.)
 
     @Override
     public void exchange(ValueVector.Mutator other) {
-      final Mutator target = (Mutator) other;
-      int temp = setCount;
-      setCount = target.setCount;
-      target.setCount = temp;
+      <#if type.major == "VarLen">
 
 Review comment:
   This is a bit subtle. The old code exchanged the `setCount` variable. But, 
it turned out that `setCount` was never actually used, so I removed it.
   
   However, this code contained a bug: it did not exchange the `lastSet` field, 
which is actually used. So, I added the code to exchange `lastSet`. But, 
`lastSet` is defined only for variable width types, where it is used to 
backfill the offset vectors.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to