You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/03/13 11:18:20 UTC

[GitHub] [arrow-rs] wangfenjin commented on a change in pull request #1432: Replace Arc with Box in ArrowArray for FFI structs

wangfenjin commented on a change in pull request #1432:
URL: https://github.com/apache/arrow-rs/pull/1432#discussion_r825432249



##########
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:
       Why we need to change ArrayData::try_from() to have &? This line seems very tricky.
   
   And as we change the ArrayData::try_from() API, all other users may also need to change the code and also add this tricky line.




-- 
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: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org