Skip to content

Commit

Permalink
use SessionStateBuilder
Browse files Browse the repository at this point in the history
The old constructor is deprecated.

Ref: apache/datafusion#11403
  • Loading branch information
Michael-J-Ward committed Aug 10, 2024
1 parent 6e816fa commit 47239c7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Arc;

use datafusion::execution::session_state::SessionStateBuilder;
use object_store::ObjectStore;
use url::Url;
use uuid::Uuid;
Expand Down Expand Up @@ -50,7 +51,7 @@ use datafusion::datasource::listing::{
use datafusion::datasource::MemTable;
use datafusion::datasource::TableProvider;
use datafusion::execution::context::{
SQLOptions, SessionConfig, SessionContext, SessionState, TaskContext,
SQLOptions, SessionConfig, SessionContext, TaskContext,
};
use datafusion::execution::disk_manager::DiskManagerConfig;
use datafusion::execution::memory_pool::{FairSpillPool, GreedyMemoryPool, UnboundedMemoryPool};
Expand Down Expand Up @@ -281,7 +282,11 @@ impl PySessionContext {
RuntimeConfig::default()
};
let runtime = Arc::new(RuntimeEnv::new(runtime_config)?);
let session_state = SessionState::new_with_config_rt(config, runtime);
let session_state = SessionStateBuilder::new()
.with_config(config)
.with_runtime_env(runtime)
.with_default_features()
.build();
Ok(PySessionContext {
ctx: SessionContext::new_with_state(session_state),
})
Expand Down

0 comments on commit 47239c7

Please sign in to comment.