Skip to content
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

Merged
merged 2 commits into from
Mar 20, 2023

Conversation

alamb
Copy link
Contributor

@alamb alamb commented Mar 13, 2023

Draft as builds on #5580

Which 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 the SessionState that is used at runtime, so I want it it into the datafusion_execution crate. SessionConfig is used in TaskContext so it needs to go first

See more details in #1754 (comment)

What changes are included in this PR?

  1. Move SessionConfig to datafusion_execution
  2. Add SessionConfig::options() / SessionConfig::options_mut() to mirror the field name and reduce redundancy
  3. Mark SessionConfig::config_options()/ SessionConfig::config_options_mut() deprecated

Are 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 API

Note 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

@github-actions github-actions bot added core Core DataFusion crate sqllogictest SQL Logic Tests (.slt) labels Mar 13, 2023
@alamb alamb force-pushed the alamb/move_session_config branch from 2d2acb7 to 5bdcb64 Compare March 13, 2023 19:11

/// Configuration options for Execution context
#[derive(Clone)]
pub struct SessionConfig {
Copy link
Contributor Author

@alamb alamb Mar 13, 2023

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::{
Copy link
Contributor Author

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.
Copy link
Contributor Author

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

@alamb alamb force-pushed the alamb/move_session_config branch from 5bdcb64 to 768cb38 Compare March 14, 2023 12:48
@alamb alamb marked this pull request as ready for review March 14, 2023 14:40
Comment on lines +246 to +256
/// 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
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering why renaming it?

Copy link
Contributor Author

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(),

Copy link
Contributor Author

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

Copy link
Member

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.

Copy link
Member

@viirya viirya left a 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.

Copy link

@snmvaughan snmvaughan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alamb alamb merged commit 232176f into apache:main Mar 20, 2023
@alamb alamb deleted the alamb/move_session_config branch October 18, 2024 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate sqllogictest SQL Logic Tests (.slt)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants