Miro-Andrin opened a new issue, #383:
URL: https://github.com/apache/arrow-cookbook/issues/383

   ```java
   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.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to