-
Notifications
You must be signed in to change notification settings - Fork 49
Open
Description
import org.apache.arrow.memory.BufferAllocator;
import org.apache.arrow.memory.RootAllocator;
import org.apache.arrow.vector.VarCharVector;
try(
BufferAllocator allocator = new RootAllocator();
VarCharVector varCharVector = new VarCharVector("varCharVector", allocator);
) {
varCharVector.allocateNew(3);
varCharVector.set(0, "one".getBytes());
varCharVector.set(1, "two".getBytes());
varCharVector.set(2, "three".getBytes());
varCharVector.setValueCount(3);
System.out.print(varCharVector);
}This snippet only works because few short strings are written. allocateNew does not grow the data buffer depending on the size of n (3 in this case). The example should either call the allocateNew method variant that specifies the byte count, use setSafe, or have a comment about this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels