MCPcopy Create free account
hub / github.com/apache/datafusion / into_state_builder

Method into_state_builder

datafusion/core/src/execution/context/mod.rs:456–467  ·  view source on GitHub ↗

Convert the current `SessionContext` into a [`SessionStateBuilder`] This is useful to switch back to `SessionState` with custom settings such as [`Self::enable_url_table`]. Avoids cloning the SessionState if possible. # Example ``` # use std::sync::Arc; # use datafusion::prelude::*; # use datafusion::execution::SessionStateBuilder; # use datafusion_optimizer::push_down_filter::PushDownFilter; l

(self)

Source from the content-addressed store, hash-verified

454 /// let builder = context.enable_url_table().into_state_builder();
455 /// ```
456 pub fn into_state_builder(self) -> SessionStateBuilder {
457 let SessionContext {
458 session_id: _,
459 session_start_time: _,
460 state,
461 } = self;
462 let state = match Arc::try_unwrap(state) {
463 Ok(rwlock) => rwlock.into_inner(),
464 Err(state) => state.read().clone(),
465 };
466 SessionStateBuilder::from(state)
467 }
468
469 /// Returns the time this `SessionContext` was created
470 pub fn session_start_time(&self) -> DateTime<Utc> {

Callers 2

enable_url_tableMethod · 0.80
fromMethod · 0.80

Calls 3

readMethod · 0.80
into_innerMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected