-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move SessionConfig
to datafusion_execution
#5581
Conversation
2d2acb7
to
5bdcb64
Compare
|
||
/// Configuration options for Execution context | ||
#[derive(Clone)] | ||
pub struct SessionConfig { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At first it seemed strange to have something called "SessionConfig" in an execution crate and I considered renaming it to ExecutionConfig
or TaskConfig
, but since both SessionState and TaskContext refer to this (and it is properly session scoped) I decided the SessionConfig
name was OK
// specific language governing permissions and limitations | ||
// under the License. | ||
|
||
use std::{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code in this module was simply moved from datafusion/core/src/execution/context.rs
@@ -1161,344 +1159,6 @@ impl QueryPlanner for DefaultQueryPlanner { | |||
} | |||
} | |||
|
|||
/// Map that holds opaque objects indexed by their type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code moved to datafusion-execution
5bdcb64
to
768cb38
Compare
/// Return a handle to the configuration options. | ||
#[deprecated(since = "21.0.0", note = "use options() instead")] | ||
pub fn config_options(&self) -> &ConfigOptions { | ||
&self.options | ||
} | ||
|
||
/// Return a mutable handle to the configuration options. | ||
#[deprecated(since = "21.0.0", note = "use options_mut() instead")] | ||
pub fn config_options_mut(&mut self) -> &mut ConfigOptions { | ||
&mut self.options | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering why renaming it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My rationale was to keep the naming consistent (the field is called options
but the method was called config_options
()`)
Also, when working with the various config often you would see
ctx.session_config().config_options(),
which seemed redundant. With this change it looks like
ctx.session_config().options(),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can avoid the rename if people prefer that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. Makes sense to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rationale looks reasonable. The change looks like moving code only (with a deprecated API which I left a question). So looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Draft as builds on #5580Which issue does this PR close?
Part of #1754
Rationale for this change
I am trying to extract the physical_plan code into its own crate; and to do so I need to remove the circular dependencies between core --> datasource --> execution --> datasource
The
TaskContext
is the part of theSessionState
that is used at runtime, so I want it it into thedatafusion_execution
crate.SessionConfig
is used inTaskContext
so it needs to go firstSee more details in #1754 (comment)
What changes are included in this PR?
SessionConfig
todatafusion_execution
SessionConfig::options()
/SessionConfig::options_mut()
to mirror the field name and reduce redundancySessionConfig::config_options()
/SessionConfig::config_options_mut()
deprecatedAre these changes tested?
Covered by existing tests
Are there any user-facing changes?
I added a
pub use
so this code movement should not affect users other than the deprecated APINote I also explored leaving
SessionConfig
in datafusion-core (see #5582) but I felt this was too disruptive and preferred to minimize API churn for users