Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions datafusion/execution/src/cache/cache_unit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ impl CacheAccessor<Path, Arc<Statistics>> for DefaultFileStatisticsCache {
.map(|x| x.1)
}

fn remove(&mut self, k: &Path) -> Option<Arc<Statistics>> {
fn remove(&self, k: &Path) -> Option<Arc<Statistics>> {
self.statistics.remove(k).map(|x| x.1 .1)
}

Expand Down Expand Up @@ -151,7 +151,7 @@ impl CacheAccessor<Path, Arc<Vec<ObjectMeta>>> for DefaultListFilesCache {
panic!("Not supported DefaultListFilesCache put_with_extra")
}

fn remove(&mut self, k: &Path) -> Option<Arc<Vec<ObjectMeta>>> {
fn remove(&self, k: &Path) -> Option<Arc<Vec<ObjectMeta>>> {
self.statistics.remove(k).map(|x| x.1)
}

Expand Down Expand Up @@ -399,7 +399,7 @@ impl CacheAccessor<ObjectMeta, Arc<dyn FileMetadata>> for DefaultFilesMetadataCa
self.put(key, value)
}

fn remove(&mut self, k: &ObjectMeta) -> Option<Arc<dyn FileMetadata>> {
fn remove(&self, k: &ObjectMeta) -> Option<Arc<dyn FileMetadata>> {
let mut state = self.state.lock().unwrap();
state.remove(k)
}
Expand Down Expand Up @@ -542,7 +542,7 @@ mod tests {
metadata: "retrieved_metadata".to_owned(),
});

let mut cache = DefaultFilesMetadataCache::new(1024 * 1024);
let cache = DefaultFilesMetadataCache::new(1024 * 1024);
assert!(cache.get(&object_meta).is_none());

// put
Expand Down Expand Up @@ -610,7 +610,7 @@ mod tests {

#[test]
fn test_default_file_metadata_cache_with_limit() {
let mut cache = DefaultFilesMetadataCache::new(1000);
let cache = DefaultFilesMetadataCache::new(1000);
let (object_meta1, metadata1) = generate_test_metadata_with_size("1", 100);
let (object_meta2, metadata2) = generate_test_metadata_with_size("2", 500);
let (object_meta3, metadata3) = generate_test_metadata_with_size("3", 300);
Expand Down Expand Up @@ -726,7 +726,7 @@ mod tests {

#[test]
fn test_default_file_metadata_cache_entries_info() {
let mut cache = DefaultFilesMetadataCache::new(1000);
let cache = DefaultFilesMetadataCache::new(1000);
let (object_meta1, metadata1) = generate_test_metadata_with_size("1", 100);
let (object_meta2, metadata2) = generate_test_metadata_with_size("2", 200);
let (object_meta3, metadata3) = generate_test_metadata_with_size("3", 300);
Expand Down
2 changes: 1 addition & 1 deletion datafusion/execution/src/cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub trait CacheAccessor<K, V>: Send + Sync {
/// Put value into cache. Returns the old value associated with the key if there was one.
fn put_with_extra(&self, key: &K, value: V, e: &Self::Extra) -> Option<V>;
/// Remove an entry from the cache, returning value if they existed in the map.
fn remove(&mut self, k: &K) -> Option<V>;
fn remove(&self, k: &K) -> Option<V>;
/// Check if the cache contains a specific key.
fn contains_key(&self, k: &K) -> bool;
/// Fetch the total number of cache entries.
Expand Down
4 changes: 4 additions & 0 deletions docs/source/library-user-guide/upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ SELECT median(c1) IGNORE NULLS FROM table

Instead of silently succeeding.

### API change for `CacheAccessor` trait

The remove API no longer requires a mutable instance

## DataFusion `51.0.0`

### `arrow` / `parquet` updated to 57.0.0
Expand Down