This is an automated email from the ASF dual-hosted git repository. felipecrv pushed a commit to branch sdf/58.4.0 in repository https://gitbox.apache.org/repos/asf/arrow-rs.git
commit 4419807fa617c6f4d9c7ab5d86c9ae94c4b9b854 Author: Felipe Oliveira Carvalho <[email protected]> AuthorDate: Mon Feb 17 11:53:19 2025 -0300 ffi_stream.rs: Align buffers when importing arrays (#4) --- arrow-array/src/ffi_stream.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arrow-array/src/ffi_stream.rs b/arrow-array/src/ffi_stream.rs index 815d7c5760..662b62c6a5 100644 --- a/arrow-array/src/ffi_stream.rs +++ b/arrow-array/src/ffi_stream.rs @@ -365,7 +365,11 @@ impl Iterator for ArrowArrayStreamReader { let result = unsafe { from_ffi_and_data_type(array, DataType::Struct(self.schema().fields().clone())) }; - Some(result.and_then(|data| { + Some(result.and_then(|mut data| { + // Ensure data is aligned (by potentially copying some buffers). + // This is needed because some Arrow C Data Interface sources(e.g. + // ADBC drivers) may produce unaligned buffers. + data.align_buffers(); let len = data.len(); RecordBatch::try_new_with_options( self.schema.clone(),
