Skip to content

Commit d05647c

Browse files
Set catalog_list from outside for SessionState. (#5277)
* Set `catalog_list` from outside for `SessionState`. * fix: resolve PR comments
1 parent 2b73119 commit d05647c

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

datafusion/core/src/execution/context.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1475,9 +1475,18 @@ pub fn default_session_builder(config: SessionConfig) -> SessionState {
14751475
impl SessionState {
14761476
/// Returns new SessionState using the provided configuration and runtime
14771477
pub fn with_config_rt(config: SessionConfig, runtime: Arc<RuntimeEnv>) -> Self {
1478+
let catalog_list = Arc::new(MemoryCatalogList::new()) as Arc<dyn CatalogList>;
1479+
Self::with_config_rt_and_catalog_list(config, runtime, catalog_list)
1480+
}
1481+
1482+
/// Returns new SessionState using the provided configuration, runtime and catalog list.
1483+
pub fn with_config_rt_and_catalog_list(
1484+
config: SessionConfig,
1485+
runtime: Arc<RuntimeEnv>,
1486+
catalog_list: Arc<dyn CatalogList>,
1487+
) -> Self {
14781488
let session_id = Uuid::new_v4().to_string();
14791489

1480-
let catalog_list = Arc::new(MemoryCatalogList::new()) as Arc<dyn CatalogList>;
14811490
if config.create_default_catalog_and_schema() {
14821491
let default_catalog = MemoryCatalogProvider::new();
14831492

0 commit comments

Comments
 (0)