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

Allow setting config extensions for TaskContext #5497

Merged
merged 2 commits into from
Mar 8, 2023

Conversation

mpurins-coralogix
Copy link
Contributor

Which issue does this PR close?

Closes #5496.

Rationale for this change

What changes are included in this PR?

  • Adds ConfigOptions::with_extensions constructor to create new config with some default extensions.
  • Chages TaskContext::new to accept config extensions to create new config using that.
  • Additionaly I renamed TaskContext::new to try_new and added return type so that any error is not ignored when setting config option

Are these changes tested?

One test added.

Are there any user-facing changes?

TaskContext::new changed to TaskContext::try_new with new argument added and which now returns result

@github-actions github-actions bot added the core Core DataFusion crate label Mar 7, 2023
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @mpurins-coralogix

I had a suggestion on the API design, but I consider it minor and I think this PR could be merged as is

@@ -2097,27 +2097,28 @@ pub struct TaskContext {

impl TaskContext {
/// Create a new task context instance
pub fn new(
pub fn try_new(
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 for the change to make this fallible

@@ -397,6 +397,13 @@ impl ConfigOptions {
Self::default()
}

/// Creates a new [`ConfigOptions`] with extensions set to provided value
pub fn with_extensions(extensions: Extensions) -> Self {
Copy link
Contributor

Choose a reason for hiding this comment

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

What would you think about making this a builder style API?

Like

Suggested change
pub fn with_extensions(extensions: Extensions) -> Self {
pub fn with_extensions(mut self, extensions: Extensions) -> Self {

So one could modify an existing ConfigOptions like:

let options = ConfigOptions::new()
  .with_extensions(extensions)

Copy link
Contributor

@alamb alamb Mar 7, 2023

Choose a reason for hiding this comment

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

The benefit of this style is that it naturally extends to setting other fields (rather than having to have a specialize constructor for each field that we want to set)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Would with builder api it would initially create one redundant instance of Extensions?

Anyway it likely doesn't really matter and I agree that it would be nicer to use. Done.

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

@alamb
Copy link
Contributor

alamb commented Mar 7, 2023

Mac Ci failure seemed unrelated to code changes in this PR https://github.com/apache/arrow-datafusion/actions/runs/4355096606/jobs/7612772747 so I retriggered it

@alamb alamb merged commit 8a1b133 into apache:main Mar 8, 2023
@ursabot
Copy link

ursabot commented Mar 8, 2023

Benchmark runs are scheduled for baseline = 0ead640 and contender = 8a1b133. 8a1b133 is a master commit associated with this PR. Results will be available as each benchmark for each run completes.
Conbench compare runs links:
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ec2-t3-xlarge-us-east-2] ec2-t3-xlarge-us-east-2
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on test-mac-arm] test-mac-arm
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-i9-9960x] ursa-i9-9960x
[Skipped ⚠️ Benchmarking of arrow-datafusion-commits is not supported on ursa-thinkcentre-m75q] ursa-thinkcentre-m75q
Buildkite builds:
Supported benchmarks:
ec2-t3-xlarge-us-east-2: Supported benchmark langs: Python, R. Runs only benchmarks with cloud = True
test-mac-arm: Supported benchmark langs: C++, Python, R
ursa-i9-9960x: Supported benchmark langs: Python, R, JavaScript
ursa-thinkcentre-m75q: Supported benchmark langs: C++, Java

@mpurins-coralogix mpurins-coralogix deleted the taskcontext-extensions branch March 15, 2023 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Core DataFusion crate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set ConfigOptions extensions in TaskContext constructor
3 participants