Skip to content

Commit

Permalink
add method SessionStateBuilder::new_with_default_features() (#14998)
Browse files Browse the repository at this point in the history
* add func SessionStateBuilder::new_with_defaults()

* update name

* add comment
  • Loading branch information
shruti2522 authored Mar 5, 2025
1 parent ee2498f commit c0d53ad
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions datafusion/core/src/execution/session_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,9 @@ impl SessionStateBuilder {
///
/// See [`Self::with_default_features`] to install the default set of functions,
/// catalogs, etc.
///
/// To create a `SessionStateBuilder` with default features such as functions,
/// please see [`Self::new_with_default_features`].
pub fn new() -> Self {
Self {
session_id: None,
Expand Down Expand Up @@ -1144,6 +1147,22 @@ impl SessionStateBuilder {
self
}

/// Returns a new [`SessionStateBuilder`] with default features.
///
/// This is equivalent to calling [`Self::new()`] followed by [`Self::with_default_features()`].
///
/// ```
/// use datafusion::execution::session_state::SessionStateBuilder;
///
/// // Create a new SessionState with default features
/// let session_state = SessionStateBuilder::new_with_default_features()
/// .with_session_id("my_session".to_string())
/// .build();
/// ```
pub fn new_with_default_features() -> Self {
Self::new().with_default_features()
}

/// Set the session id.
pub fn with_session_id(mut self, session_id: String) -> Self {
self.session_id = Some(session_id);
Expand Down

0 comments on commit c0d53ad

Please sign in to comment.