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 5ddddbdd7c Minor: avoid clone in RunArray row decoding via buffer 
stealing (#9052)
5ddddbdd7c is described below

commit 5ddddbdd7cc3ad84371d4438fa286d0e2e3401ce
Author: Lanqing Yang <[email protected]>
AuthorDate: Tue Dec 30 21:34:19 2025 +0900

    Minor: avoid clone in RunArray row decoding via buffer stealing (#9052)
    
    # Which issue does this PR close?
    its a nitpick to replace
    "allocation + memcpy" with "allocation only".
    
    
    # Rationale for this change
    remove the value clone in decode path
    `decoded_values.push(decoded_data.clone())`
    and taking from decoded_data directly
    
    
    # What changes are included in this PR?
    
    
    # Are these changes tested?
    
    i think the current testing suite will do
    # Are there any user-facing changes?
    
    no
    
    Signed-off-by: lyang24 <[email protected]>
---
 arrow-row/src/run.rs | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arrow-row/src/run.rs b/arrow-row/src/run.rs
index 3d962f43ad..24eaaa18e0 100644
--- a/arrow-row/src/run.rs
+++ b/arrow-row/src/run.rs
@@ -134,7 +134,11 @@ pub unsafe fn decode<R: RunEndIndexType>(
                 run_ends.push(R::Native::usize_as(idx));
             }
             unique_row_indices.push(decoded_values.len());
-            decoded_values.push(decoded_data.clone());
+            let capacity = decoded_data.capacity();
+            decoded_values.push(std::mem::replace(
+                &mut decoded_data,
+                Vec::with_capacity(capacity),
+            ));
         }
     }
     // Add the final run end

Reply via email to