Skip to content

Commit e848602

Browse files
committed
WIP: MetadataCacheFactory::make_session_config
1 parent b90bac5 commit e848602

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

rust/cubestore/cubestore/src/queryplanner/metadata_cache.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ use datafusion::datasource::physical_plan::{FileMeta, ParquetFileReaderFactory};
44
use datafusion::parquet::arrow::async_reader::AsyncFileReader;
55
use datafusion::parquet::file::metadata::ParquetMetaData;
66
use datafusion::physical_plan::metrics::ExecutionPlanMetricsSet;
7+
use datafusion::prelude::SessionConfig;
78
use futures_util::future::BoxFuture;
89
use futures_util::FutureExt;
910
use std::fmt;
@@ -22,6 +23,9 @@ pub trait MetadataCacheFactory: Sync + Send {
2223
max_capacity: u64,
2324
time_to_idle: Duration,
2425
) -> Arc<dyn ParquetFileReaderFactory>;
26+
fn make_session_config(&self) -> SessionConfig {
27+
SessionConfig::new()
28+
}
2529
}
2630
/// Default MetadataCache, does not cache anything
2731
#[derive(Debug)]

rust/cubestore/cubestore/src/queryplanner/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,7 @@ impl QueryPlannerImpl {
245245
}
246246

247247
impl QueryPlannerImpl {
248-
pub fn make_execution_context() -> SessionContext {
249-
let config = SessionConfig::new();
248+
pub fn execution_context_helper(config: SessionConfig) -> SessionContext {
250249
let context = SessionContext::new_with_config(config);
251250
// TODO upgrade DF: build SessionContexts consistently -- that now means check all appropriate SessionContext constructors use this make_execution_context or execution_context function.
252251
for udaf in registerable_aggregate_udfs() {
@@ -267,8 +266,12 @@ impl QueryPlannerImpl {
267266
context
268267
}
269268

269+
pub fn make_execution_context() -> SessionContext {
270+
Self::execution_context_helper(SessionConfig::new())
271+
}
272+
270273
async fn execution_context(&self) -> Result<Arc<SessionContext>, CubeError> {
271-
Ok(Arc::new(Self::make_execution_context()))
274+
Ok(Arc::new(Self::execution_context_helper(self.metadata_cache_factory.make_session_config())))
272275
}
273276
}
274277

0 commit comments

Comments
 (0)