goutamadwant commented on code in PR #1192:
URL: https://github.com/apache/arrow-java/pull/1192#discussion_r3556096419


##########
vector/src/main/java/org/apache/arrow/vector/BaseVariableWidthViewVector.java:
##########
@@ -1405,7 +1405,8 @@ public final int getTotalValueLengthUpToIndex(int index) {
   }
 
   protected final void handleSafe(int index, int dataLength) {
-    final long targetCapacity = roundUpToMultipleOf16((long) index * 
ELEMENT_SIZE + dataLength);
+    // The view buffer stores one fixed-width view per value; payload bytes 
are allocated separately.
+    final long targetCapacity = roundUpToMultipleOf16(((long) index + 1) * 
ELEMENT_SIZE);

Review Comment:
   Thanks for reviewing @mbutrovich . I kept this code path unchanged since it 
reserves the full view slot regardless of payload size and the cast keeps the 
sizing expression safe before the multiplication. Let me know if there any 
other thoughts. 



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