alamb commented on code in PR #11403:
URL: https://github.com/apache/datafusion/pull/11403#discussion_r1676326033
##########
datafusion/core/src/execution/session_state.rs:
##########
@@ -976,6 +837,482 @@ impl SessionState {
}
}
+/// A builder to be used for building [`SessionState`]'s. Defaults will be
used for all values
+/// unless explicitly provided. Note that there is no `Default` or `new()` for
SessionState,
+/// to avoid accidentally running queries or other operations without passing
through
+/// the [`SessionConfig`] or [`RuntimeEnv`].
+pub struct SessionStateBuilder {
+ state: SessionState,
+ use_defaults: bool,
+}
+
+impl SessionStateBuilder {
+ /// Returns new [`SessionStateBuilder`] using the provided
+ /// [`SessionConfig`] and [`RuntimeEnv`].
+ pub fn new_with_config_rt(
Review Comment:
I was thinking that if the config and runtime weren't provided then it would
make the defaults
Something like this perhaps
```rust
fn build(self) -> SessionConfig {
let Self { config, ... } = self;
// config is None if not provided explicitly
let config = config.unwrap_or_else(|| SessionConfig::default);
...
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]