Skip to content

Commit 2d8000f

Browse files
adriangbmartin-g
andcommitted
Apply suggestions from code review
Co-authored-by: Martin Grigorov <[email protected]>
1 parent f8f4903 commit 2d8000f

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎datafusion/execution/src/cache/file_metadata_cache.rs‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ impl DefaultFilesMetadataCacheState {
6161
.get(k)
6262
.map(|sized| sized.entry.clone())
6363
.inspect(|_| {
64-
*self.cache_hits.entry(k.clone()).or_insert(0) += 1;
64+
if let Some(hits) = self.cache_hits.get_mut(k) {
65+
*hits += 1;
66+
}
6567
})
6668
}
6769

@@ -110,6 +112,7 @@ impl DefaultFilesMetadataCacheState {
110112
while self.memory_used > self.memory_limit {
111113
if let Some(removed) = self.lru_queue.pop() {
112114
self.memory_used -= removed.1.size;
115+
self.cache_hits.remove(&removed.0);
113116
} else {
114117
// cache is empty while memory_used > memory_limit, cannot happen
115118
debug_assert!(

0 commit comments

Comments
 (0)