This is an automated email from the ASF dual-hosted git repository.
alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new d05647c65 Set `catalog_list` from outside for `SessionState`. (#5277)
d05647c65 is described below
commit d05647c65e14d865b854a845ae970797a6086e2c
Author: LFC <[email protected]>
AuthorDate: Thu Feb 16 04:00:07 2023 +0800
Set `catalog_list` from outside for `SessionState`. (#5277)
* Set `catalog_list` from outside for `SessionState`.
* fix: resolve PR comments
---
datafusion/core/src/execution/context.rs | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/datafusion/core/src/execution/context.rs
b/datafusion/core/src/execution/context.rs
index 0873895f7..c2ac3c2e9 100644
--- a/datafusion/core/src/execution/context.rs
+++ b/datafusion/core/src/execution/context.rs
@@ -1475,9 +1475,18 @@ pub fn default_session_builder(config: SessionConfig) ->
SessionState {
impl SessionState {
/// Returns new SessionState using the provided configuration and runtime
pub fn with_config_rt(config: SessionConfig, runtime: Arc<RuntimeEnv>) ->
Self {
+ let catalog_list = Arc::new(MemoryCatalogList::new()) as Arc<dyn
CatalogList>;
+ Self::with_config_rt_and_catalog_list(config, runtime, catalog_list)
+ }
+
+ /// Returns new SessionState using the provided configuration, runtime and
catalog list.
+ pub fn with_config_rt_and_catalog_list(
+ config: SessionConfig,
+ runtime: Arc<RuntimeEnv>,
+ catalog_list: Arc<dyn CatalogList>,
+ ) -> Self {
let session_id = Uuid::new_v4().to_string();
- let catalog_list = Arc::new(MemoryCatalogList::new()) as Arc<dyn
CatalogList>;
if config.create_default_catalog_and_schema() {
let default_catalog = MemoryCatalogProvider::new();