sunchao commented on a change in pull request #1449:
URL: https://github.com/apache/arrow-rs/pull/1449#discussion_r830215606
##########
File path: arrow/src/ffi.rs
##########
@@ -802,6 +810,35 @@ impl ArrowArray {
pub fn into_raw(this: ArrowArray) -> (*const FFI_ArrowArray, *const
FFI_ArrowSchema) {
(Arc::into_raw(this.array), Arc::into_raw(this.schema))
}
+
+ /// exports [ArrowArray] to raw pointers of the C Data Interface provided
by the consumer.
Review comment:
nit: "Exports"
##########
File path: arrow/src/ffi.rs
##########
@@ -802,6 +810,35 @@ impl ArrowArray {
pub fn into_raw(this: ArrowArray) -> (*const FFI_ArrowArray, *const
FFI_ArrowSchema) {
(Arc::into_raw(this.array), Arc::into_raw(this.schema))
}
+
+ /// exports [ArrowArray] to raw pointers of the C Data Interface provided
by the consumer.
+ /// # Safety
+ /// See safety of [ArrowArray]
+ /// This function copies the content of two FFI structs [FFI_ArrowArray]
and [FFI_ArrowSchema] in
+ /// this [ArrowArray] to the location pointed by the raw pointers. Usually
the raw pointers are
+ /// provided by the array data consumer.
+ pub unsafe fn export_into_raw(
+ this: ArrowArray,
Review comment:
Can we have this is `src/array/array.rs` and have it to be a top-level
function, paired to `make_array_from_raw`?
The signature can be something:
```rust
pub unsafe fn export_array_into_raw(
src: &ArrayRef,
out_array: *mut FFI_ArrowArray,
out_schema: *mut FFI_ArrowSchema)
```
It's better to also update the usage doc at the top of this file.
--
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]