John-W-Lewis opened a new pull request, #1145:
URL: https://github.com/apache/arrow-java/pull/1145

   ## What's Changed
   
   `VectorSchemaRoot#addVector` and `#removeVector` previously created a new 
`VectorSchemaRoot` by sharing raw `FieldVector` references between the original 
and new root. This violates Arrow's ownership model: closing either root would 
release buffers still in use by the other, leading to use-after-free errors.
   
   This fix uses `TransferPair` to properly transfer buffer ownership to the 
returned root, consistent with how `VectorSchemaRoot#slice` already handles 
this. After the operation, the original root's vectors are left in a 
transferred (empty) state and can be reused via `allocateNew()`.
   
   Tests added to verify that the returned root's data remains valid after the 
original root and input vector are closed.
   
   Closes #1142.
   
   Made with [Cursor](https://cursor.com)


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