Repository navigation
Split SessionState into its own module - #10794
Conversation
There was a problem hiding this comment.
Can we name it as session_state?
| pub fn state(&self) -> SessionState { | ||
| let mut state = self.state.read().clone(); | ||
| state.execution_props.start_execution(); | ||
| state.execution_props_mut().start_execution(); |
There was a problem hiding this comment.
It is needed because the start execution method actually modifies the execution_props field -- when SessionContext was part of the same module, it could simply directly modify state.execution_props (the field, not a method)
Now that they are in separate modules, SessionContext can't modify SessionState internal fields directly.
So TLDR is that this code does the same as the previous version (modifies execution_props) but is more explicit about it, which I think is an improvement
| use url::Url; | ||
| use uuid::Uuid; | ||
|
|
||
| /// Execution context for registering data sources and executing queries. |
There was a problem hiding this comment.
This is just moved from context/mod.rs
| }; | ||
| use sqlparser::dialect::dialect_from_str; | ||
|
|
||
| // backwards compatibility |
There was a problem hiding this comment.
This pub use means there should be no downstream changes required
Sorry I should have pointed that out -- I left a |
|
Thanks again for the reviews |
* Split `SessionState` into its own module * fix docs * fix test * Rename state.rs to session_state.rs
Which issue does this PR close?
Part of #10782
Rationale for this change
the
datafusion/core/src/execution/context/mod.rsfile is quite large and hard to navigate.It would be better to have SessionContext and SessionState in their own modules
Also, if we ever are able to break out catalog from the core, e.g. #10782 we may have to break out
SessionStateas well, so having SessionState in its own module will help hereIt also turns out splitting them into their own files makes the boundaries a bit clearer
What changes are included in this PR?
SessionStateout ofdatafusion/core/src/execution/context/mod.rsand intodatafusion/core/src/execution/state.rspub useSessionStateto maintain the same behaviorAre these changes tested?
Exiting CI
Are there any user-facing changes?
No, this is an internal code reorganization only