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 a8346be02a Minor: make it clear cache array reader is not cloning 
arrays (#9057)
a8346be02a is described below

commit a8346be02a240788b1246d847bc8dfec21274306
Author: Andrew Lamb <[email protected]>
AuthorDate: Wed Jan 7 12:06:24 2026 -0500

    Minor: make it clear cache array reader is not cloning arrays (#9057)
    
    # Which issue does this PR close?
    
    - related to https://github.com/apache/datafusion/pull/19477
    
    
    # Rationale for this change
    
    I am tracking down allocations in various parts of the parquet reader
    (to remove them) and I ran across this in the cached reader.
    
    # What changes are included in this PR?
    
    Use `Arc::clone` to make it clear there is no deep cloning going on . I
    don't expect this will have any impact on actual performance
    
    # Are these changes tested?
    
    By CI
    # Are there any user-facing changes?
    
    <!--
    If there are user-facing changes then we may require documentation to be
    updated before approving the PR.
    
    If there are any breaking changes to public APIs, please call them out.
    -->
---
 parquet/src/arrow/array_reader/cached_array_reader.rs | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/parquet/src/arrow/array_reader/cached_array_reader.rs 
b/parquet/src/arrow/array_reader/cached_array_reader.rs
index a2fa0e9035..b55b1e1d1a 100644
--- a/parquet/src/arrow/array_reader/cached_array_reader.rs
+++ b/parquet/src/arrow/array_reader/cached_array_reader.rs
@@ -201,7 +201,7 @@ impl ArrayReader for CachedArrayReader {
 
             // Check local cache first
             let cached = if let Some(array) = self.local_cache.get(&batch_id) {
-                Some(array.clone())
+                Some(Arc::clone(array))
             } else {
                 // If not in local cache, i.e., we are consumer, check shared 
cache
                 let cache_content = self
@@ -211,7 +211,7 @@ impl ArrayReader for CachedArrayReader {
                     .get(self.column_idx, batch_id);
                 if let Some(array) = cache_content.as_ref() {
                     // Store in local cache for later use in consume_batch
-                    self.local_cache.insert(batch_id, array.clone());
+                    self.local_cache.insert(batch_id, Arc::clone(array));
                 }
                 cache_content
             };

Reply via email to