Skip to content

Commit c0d53ad

Browse files
authored
add method SessionStateBuilder::new_with_default_features() (#14998)
* add func SessionStateBuilder::new_with_defaults() * update name * add comment
1 parent ee2498f commit c0d53ad

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

datafusion/core/src/execution/session_state.rs

+19
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,9 @@ impl SessionStateBuilder {
10231023
///
10241024
/// See [`Self::with_default_features`] to install the default set of functions,
10251025
/// catalogs, etc.
1026+
///
1027+
/// To create a `SessionStateBuilder` with default features such as functions,
1028+
/// please see [`Self::new_with_default_features`].
10261029
pub fn new() -> Self {
10271030
Self {
10281031
session_id: None,
@@ -1144,6 +1147,22 @@ impl SessionStateBuilder {
11441147
self
11451148
}
11461149

1150+
/// Returns a new [`SessionStateBuilder`] with default features.
1151+
///
1152+
/// This is equivalent to calling [`Self::new()`] followed by [`Self::with_default_features()`].
1153+
///
1154+
/// ```
1155+
/// use datafusion::execution::session_state::SessionStateBuilder;
1156+
///
1157+
/// // Create a new SessionState with default features
1158+
/// let session_state = SessionStateBuilder::new_with_default_features()
1159+
/// .with_session_id("my_session".to_string())
1160+
/// .build();
1161+
/// ```
1162+
pub fn new_with_default_features() -> Self {
1163+
Self::new().with_default_features()
1164+
}
1165+
11471166
/// Set the session id.
11481167
pub fn with_session_id(mut self, session_id: String) -> Self {
11491168
self.session_id = Some(session_id);

0 commit comments

Comments
 (0)