Correctly set capacity of remainder in DefaultDataBuffer::split

This commit ensures that the capacity of the remainder buffer after a
split operation is set directly on the field. Calling capacity(int)
caused a new buffer to be allocated.

See gh-31848
Closes gh-31859
This commit is contained in:
Arjen Poutsma
2023-12-18 11:43:18 +01:00
parent bafff5079f
commit b272f4e615

View File

@@ -371,7 +371,7 @@ public class DefaultDataBuffer implements DataBuffer {
.slice();
this.writePosition = Math.max(this.writePosition, index) - index;
this.readPosition = Math.max(this.readPosition, index) - index;
capacity(this.byteBuffer.capacity());
this.capacity = this.byteBuffer.capacity();
return result;
}