diff --git a/datafusion/core/src/datasource/listing/table.rs b/datafusion/core/src/datasource/listing/table.rs index 29da13ff6b4d4..5075797f2add3 100644 --- a/datafusion/core/src/datasource/listing/table.rs +++ b/datafusion/core/src/datasource/listing/table.rs @@ -992,10 +992,6 @@ mod tests { use arrow::record_batch::RecordBatch; use datafusion_common::assert_contains; use datafusion_common::GetExt; - use datafusion_execution::cache::cache_manager::CacheManagerConfig; - use datafusion_execution::cache::cache_unit; - use datafusion_execution::cache::cache_unit::DefaultFileStatisticsCache; - use datafusion_execution::runtime_env::{RuntimeConfig, RuntimeEnv}; use datafusion_expr::LogicalPlanBuilder; use rstest::*; use std::collections::HashMap; diff --git a/datafusion/execution/src/cache/cache_manager.rs b/datafusion/execution/src/cache/cache_manager.rs index 6f087c504d2f5..987b47bbb8f5c 100644 --- a/datafusion/execution/src/cache/cache_manager.rs +++ b/datafusion/execution/src/cache/cache_manager.rs @@ -19,6 +19,7 @@ use crate::cache::CacheAccessor; use datafusion_common::{Result, Statistics}; use object_store::path::Path; use object_store::ObjectMeta; +use std::fmt::{Debug, Formatter}; use std::sync::Arc; /// The cache of listing files statistics. @@ -28,7 +29,13 @@ use std::sync::Arc; pub type FileStatisticsCache = Arc, Extra = ObjectMeta>>; -#[derive(Default)] +impl Debug for dyn CacheAccessor, Extra = ObjectMeta> { + fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { + write!(f, "Cache name: {} with length: {}", self.name(), self.len()) + } +} + +#[derive(Default, Debug)] pub struct CacheManager { file_statistic_cache: Option, } diff --git a/datafusion/execution/src/cache/cache_unit.rs b/datafusion/execution/src/cache/cache_unit.rs index 6688a1e09a359..4439e82004461 100644 --- a/datafusion/execution/src/cache/cache_unit.rs +++ b/datafusion/execution/src/cache/cache_unit.rs @@ -89,6 +89,10 @@ impl CacheAccessor> for DefaultFileStatisticsCache { fn clear(&self) { self.statistics.clear() } + + fn name(&self) -> String { + "DefaultFileStatisticsCache".to_string() + } } #[cfg(test)] diff --git a/datafusion/execution/src/cache/mod.rs b/datafusion/execution/src/cache/mod.rs index 2c3d027d2587d..9daa107bf8edd 100644 --- a/datafusion/execution/src/cache/mod.rs +++ b/datafusion/execution/src/cache/mod.rs @@ -47,4 +47,6 @@ pub trait CacheAccessor: Send + Sync { } /// Removes all entries from the cache. fn clear(&self); + /// Return the cache name. + fn name(&self) -> String; } diff --git a/testing b/testing index 2c84953c8c277..e81d0c6de3594 160000 --- a/testing +++ b/testing @@ -1 +1 @@ -Subproject commit 2c84953c8c2779a0dc86ef9ebe8a6cd978125bfe +Subproject commit e81d0c6de35948b3be7984af8e00413b314cde6e