Skip to content

Commit 58683e4

Browse files
siddharthteotiayongyanw
authored andcommitted
Fix setValueCount in splitAndTransfer of Variable Width Vector.
We need to use the split length as the value count of the target vector. We are incorrectly using the value count of the current vector for the target vector. Thus the latter ends up asking for a realloc when it didn't really need extra memory.
1 parent a97b757 commit 58683e4

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -711,9 +711,7 @@ public void splitAndTransferTo(int startIndex, int length,
711711
splitAndTransferValidityBuffer(startIndex, length, target);
712712
splitAndTransferOffsetBuffer(startIndex, length, target);
713713
target.setLastSet(length - 1);
714-
if (this.valueCount > 0) {
715-
target.setValueCount(this.valueCount);
716-
}
714+
target.setValueCount(length);
717715
}
718716

719717
/*

0 commit comments

Comments
 (0)