This is an automated email from the ASF dual-hosted git repository.

tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-rs.git


The following commit(s) were added to refs/heads/master by this push:
     new 31b865ebcb use from_ffi_and_data_type instead (#5248)
31b865ebcb is described below

commit 31b865ebcbf54830fd35131fbfe31e5a7e00136c
Author: Jay Han <[email protected]>
AuthorDate: Sat Dec 30 00:50:52 2023 +0800

    use from_ffi_and_data_type instead (#5248)
---
 .gitignore              |  1 +
 arrow/src/ffi_stream.rs | 11 +++++------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/.gitignore b/.gitignore
index 52ad19cb07..efdd9de5fb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -5,6 +5,7 @@ rusty-tags.vi
 .flatbuffers/
 .idea/
 .vscode
+.devcontainer
 venv/*
 # created by doctests
 parquet/data.parquet
diff --git a/arrow/src/ffi_stream.rs b/arrow/src/ffi_stream.rs
index bbec71e883..3d1fb5effd 100644
--- a/arrow/src/ffi_stream.rs
+++ b/arrow/src/ffi_stream.rs
@@ -54,6 +54,7 @@
 //! }
 //! ```
 
+use arrow_schema::DataType;
 use std::ffi::CStr;
 use std::ptr::addr_of;
 use std::{
@@ -356,12 +357,10 @@ impl Iterator for ArrowArrayStreamReader {
                 return None;
             }
 
-            let schema_ref = self.schema();
-            // NOTE: this parses the FFI_ArrowSchema again on each iterator 
call;
-            // should probably use from_ffi_and_data_type() instead.
-            let schema = FFI_ArrowSchema::try_from(schema_ref.as_ref()).ok()?;
-
-            let data = unsafe { from_ffi(array, &schema) }.ok()?;
+            let data = unsafe {
+                from_ffi_and_data_type(array, 
DataType::Struct(self.schema().fields().clone()))
+            }
+            .ok()?;
 
             let record_batch = RecordBatch::from(StructArray::from(data));
 

Reply via email to