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

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


The following commit(s) were added to refs/heads/main by this push:
     new b64b458595 Avoid a clone when creating `FixedSizeListArray` from 
ArrayData (#9187)
b64b458595 is described below

commit b64b4585959f77deb4be7b4101842f21151aef06
Author: Andrew Lamb <[email protected]>
AuthorDate: Wed Jan 21 08:55:26 2026 -0500

    Avoid a clone when creating `FixedSizeListArray` from ArrayData (#9187)
    
    # Which issue does this PR close?
    
    - Part of https://github.com/apache/arrow-rs/issues/9061
    - broken out of https://github.com/apache/arrow-rs/pull/9058
    
    # Rationale for this change
    
    Let's make arrow-rs the fastest we can and the fewer allocations the
    better
    
    # What changes are included in this PR?
    
    Apply pattern from https://github.com/apache/arrow-rs/pull/9114
    
    # Are these changes tested?
    
    Existing tests
    
    # Are there any user-facing changes?
    
    No
---
 arrow-array/src/array/fixed_size_list_array.rs | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/arrow-array/src/array/fixed_size_list_array.rs 
b/arrow-array/src/array/fixed_size_list_array.rs
index f53b042f87..5a37d7f3e9 100644
--- a/arrow-array/src/array/fixed_size_list_array.rs
+++ b/arrow-array/src/array/fixed_size_list_array.rs
@@ -429,8 +429,10 @@ impl FixedSizeListArray {
 
 impl From<ArrayData> for FixedSizeListArray {
     fn from(data: ArrayData) -> Self {
-        let value_length = match data.data_type() {
-            DataType::FixedSizeList(_, len) => *len,
+        let (data_type, len, nulls, offset, _buffers, child_data) = 
data.into_parts();
+
+        let value_length = match data_type {
+            DataType::FixedSizeList(_, len) => len,
             data_type => {
                 panic!(
                     "FixedSizeListArray data should contain a FixedSizeList 
data type, got {data_type}"
@@ -439,14 +441,13 @@ impl From<ArrayData> for FixedSizeListArray {
         };
 
         let size = value_length as usize;
-        let values =
-            make_array(data.child_data()[0].slice(data.offset() * size, 
data.len() * size));
+        let values = make_array(child_data[0].slice(offset * size, len * 
size));
         Self {
-            data_type: data.data_type().clone(),
+            data_type,
             values,
-            nulls: data.nulls().cloned(),
+            nulls,
             value_length,
-            len: data.len(),
+            len,
         }
     }
 }

Reply via email to