ritchie46 commented on a change in pull request #9778:
URL: https://github.com/apache/arrow/pull/9778#discussion_r601192799



##########
File path: rust/arrow/src/ffi.rs
##########
@@ -425,6 +447,27 @@ unsafe fn create_buffer(
     NonNull::new(ptr as *mut u8).map(|ptr| Buffer::from_unowned(ptr, len, 
array))
 }
 
+unsafe fn create_child_arrays(
+    array: Arc<FFI_ArrowArray>,
+    schema: Arc<FFI_ArrowSchema>,
+) -> Result<Vec<ArrayData>> {
+    if array.n_children == 0 {
+        return Ok(vec![]);
+    }
+    let mut children = Vec::with_capacity(array.n_children as usize);
+    for i in 0..array.n_children as usize {
+        let arr_ptr = *array.children.add(i);
+        let schema_ptr = *schema.children.add(i);
+        let arrow_arr = ArrowArray::try_from_raw(
+            arr_ptr as *const FFI_ArrowArray,
+            schema_ptr as *const FFI_ArrowSchema,
+        )?;
+        let data = ArrayData::try_from(arrow_arr)?;
+        children.push(data)
+    }
+    Ok(children)

Review comment:
       Yes! Clippy missed that one. :)




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to