viirya commented on a change in pull request #1432:
URL: https://github.com/apache/arrow-rs/pull/1432#discussion_r825591940
##########
File path: arrow/src/array/array.rs
##########
@@ -629,7 +629,9 @@ pub unsafe fn make_array_from_raw(
schema: *const ffi::FFI_ArrowSchema,
) -> Result<ArrayRef> {
let array = ffi::ArrowArray::try_from_raw(array, schema)?;
- let data = ArrayData::try_from(array)?;
+ let data = ArrayData::try_from(&array)?;
+ // Avoid dropping the `Box` pointers and trigger the `release` mechanism.
+ let _ = ffi::ArrowArray::into_raw(array);
Review comment:
I think `from(v: Box<T>)` only copies the content of the structs, i.e.,
the pointer. The array data is out of the structs. I think this is basically
similar to #1436, i.e. cloning the source structs and making sure we don't
trigger `release` on source structs (either cleaning up `release`, or
like`from(v: Box<T>)` to copy it by bytes without dropping it).
I think `from(v: Box<T>)` should work for our usecase, but I need to test it
to make sure we don't miss anything. I will update this accordingly.
--
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]