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

    https://github.com/apache/drill/pull/860#discussion_r127344297
  
    --- Diff: exec/vector/src/main/codegen/templates/VariableLengthVectors.java 
---
    @@ -247,27 +249,26 @@ public void copyEntry(int toIndex, ValueVector from, 
int fromIndex) {
       }
     
       @Override
    -  public int getAllocatedByteCount() {
    -    return offsetVector.getAllocatedByteCount() + 
super.getAllocatedByteCount();
    +  public void getLedgers(Set<BufferLedger> ledgers) {
    +    offsetVector.getLedgers(ledgers);
    +    super.getLedgers(ledgers);
       }
     
       @Override
    -  public int getPayloadByteCount() {
    -    UInt${type.width}Vector.Accessor a = offsetVector.getAccessor();
    -    int count = a.getValueCount();
    -    if (count == 0) {
    +  public int getPayloadByteCount(int valueCount) {
    +    if (valueCount == 0) {
           return 0;
    -    } else {
    -      // If 1 or more values, then the last value is set to
    -      // the offset of the next value, which is the same as
    -      // the length of existing values.
    -      // In addition to the actual data bytes, we must also
    -      // include the "overhead" bytes: the offset vector entries
    -      // that accompany each column value. Thus, total payload
    -      // size is consumed text bytes + consumed offset vector
    -      // bytes.
    -      return a.get(count-1) + offsetVector.getPayloadByteCount();
         }
    +    // If 1 or more values, then the last value is set to
    +    // the offset of the next value, which is the same as
    +    // the length of existing values.
    +    // In addition to the actual data bytes, we must also
    +    // include the "overhead" bytes: the offset vector entries
    +    // that accompany each column value. Thus, total payload
    +    // size is consumed text bytes + consumed offset vector
    +    // bytes.
    +    return offsetVector.getAccessor().get(valueCount) +
    --- End diff --
    
    Should this be **(valueCount - 1)** ??



---
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