Github user Ben-Zvi commented on a diff in the pull request:

    https://github.com/apache/drill/pull/800#discussion_r114036665
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/cache/VectorAccessibleSerializable.java
 ---
    @@ -146,36 +157,24 @@ public void writeToStream(OutputStream output) throws 
IOException {
         final DrillBuf[] incomingBuffers = batch.getBuffers();
         final UserBitShared.RecordBatchDef batchDef = batch.getDef();
     
    -    /* DrillBuf associated with the selection vector */
    -    DrillBuf svBuf = null;
    -    Integer svCount =  null;
    -
    -    if (svMode == BatchSchema.SelectionVectorMode.TWO_BYTE) {
    -      svCount = sv2.getCount();
    -      svBuf = sv2.getBuffer(); //this calls retain() internally
    -    }
    -
         try {
           /* Write the metadata to the file */
           batchDef.writeDelimitedTo(output);
     
           /* If we have a selection vector, dump it to file first */
    -      if (svBuf != null) {
    -        allocator.write(svBuf, output);
    -        sv2.setBuffer(svBuf);
    -        svBuf.release(); // sv2 now owns the buffer
    -        sv2.setRecordCount(svCount);
    +      if (svMode == BatchSchema.SelectionVectorMode.TWO_BYTE) {
    +        recordCount = sv2.getCount();
    --- End diff --
    
    Ultra minor comment: When SV2 is read, the recordCount comes from the 
batchDef; here it is taken from the sv2 itself (they should be the same anyway 
....)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to