Skip to content

Commit a8346be

Browse files
authored
Minor: make it clear cache array reader is not cloning arrays (#9057)
# Which issue does this PR close? - related to apache/datafusion#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. -->
1 parent 721f373 commit a8346be

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

parquet/src/arrow/array_reader/cached_array_reader.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ impl ArrayReader for CachedArrayReader {
201201

202202
// Check local cache first
203203
let cached = if let Some(array) = self.local_cache.get(&batch_id) {
204-
Some(array.clone())
204+
Some(Arc::clone(array))
205205
} else {
206206
// If not in local cache, i.e., we are consumer, check shared cache
207207
let cache_content = self
@@ -211,7 +211,7 @@ impl ArrayReader for CachedArrayReader {
211211
.get(self.column_idx, batch_id);
212212
if let Some(array) = cache_content.as_ref() {
213213
// Store in local cache for later use in consume_batch
214-
self.local_cache.insert(batch_id, array.clone());
214+
self.local_cache.insert(batch_id, Arc::clone(array));
215215
}
216216
cache_content
217217
};

0 commit comments

Comments
 (0)