viirya commented on code in PR #40043:
URL: https://github.com/apache/arrow/pull/40043#discussion_r1488691126


##########
java/vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthVector.java:
##########
@@ -476,11 +507,12 @@ private void allocateBytes(final long valueBufferSize, 
final int valueCount) {
   }
 
   /* allocate offset buffer */
-  private void allocateOffsetBuffer(final long size) {
+  private ArrowBuf allocateOffsetBuffer(final long size) {

Review Comment:
   > I think Antoine's idea was that you could statically allocate one such 
buffer to use in such situations, if you're talking about this
   > 
   > > As long as data stays internal to Arrow Java, the missing buffer is ok, 
but for purposes of exchanging data, a proper offsets buffers should be 
exported (this one can easily be statically allocated, by the way).
   
   Hmm, I think what Antoine means is, we should export a proper offset buffer 
(instead of empty one currently) for exporting purpose, isn't?
   
   > (1) why? If we're allocating the buffer, we may as well use it for the 
vector as well.
   
   I'm not sure how it conflicts with your first question?
   
   Do you mean, we should overwrite existing offset buffer once we allocate 
that one value offset buffer?
   
   I thought about it and tried, but it is actually similar as my first attempt 
that changes the initial offset buffers from empty one to be one value buffer.
   
   More trouble is, many code in Java Arrow assumes the offset initial capacity 
is 0. At my first attempt to change it to 1, I have to change these places. If 
the initial capacity could be either 0 or 1, the inconsistency causes more 
complication around these places.
   
   
   
   



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