Skip to content

Conversation

@tustvold
Copy link
Contributor

Which issue does this PR close?

Relates to #4517

Rationale for this change

Config keys are almost always static strings, currently we allocate a String for each of these, and clone these allocations when we clone SessionConfig, which is done multiple times per query. Switching to use Cow<'static, str> avoids this.

I prevaricated about this change as we may eventually change ConfigOptions into a struct, but thought I'd propose it anyway and see what people thought

What changes are included in this PR?

This changes the definition of ConfigOptions to avoid boxing static strings.

Are these changes tested?

Are there any user-facing changes?

@github-actions github-actions bot added the core Core DataFusion crate label Dec 28, 2022
@tustvold tustvold added the api change Changes the API exposed to users of the crate label Dec 28, 2022
pub struct ConfigDefinition {
/// key used to identifier this configuration option
key: String,
key: Cow<'static, str>,
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 using Arc here instead?

Arc might would be more consistent with the rest of the DataFusion codebase as well as help systems like Ballista where the configuration was serialized / deserialized.

I believe with a Cow and without any extra work, the deserialized ConfigOptions will still be owned (and copied) Strings

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm... You raise a good point r.e. serialization, perhaps we should just make ConfigOptions a struct... I'll leave this open if anyone else has any thoughts

@tustvold tustvold marked this pull request as draft December 28, 2022 14:03
@tustvold
Copy link
Contributor Author

Closing in favour of #4771

@tustvold tustvold closed this Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api change Changes the API exposed to users of the crate core Core DataFusion crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants