You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/12/28 12:07:15 UTC

[GitHub] [arrow-datafusion] tustvold opened a new pull request, #4762: Avoid boxing config keys

tustvold opened a new pull request, #4762:
URL: https://github.com/apache/arrow-datafusion/pull/4762

   # Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   Relates to #4517 
   
   # Rationale for this change
   
   <!--
    Why are you proposing this change? If this is already explained clearly in the issue then this section is not needed.
    Explaining clearly why changes are proposed helps reviewers understand your changes and offer better suggestions for fixes.  
   -->
   
   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?
   
   <!--
   There is no need to duplicate the description in the issue here but it is sometimes worth providing a summary of the individual changes in this PR.
   -->
   
   This changes the definition of `ConfigOptions` to avoid boxing static strings.
   
   # Are these changes tested?
   
   <!--
   We typically require tests for all PRs in order to:
   1. Prevent the code from being accidentally broken by subsequent changes
   2. Serve as another way to document the expected behavior of the code
   
   If tests are not included in your PR, please explain why (for example, are they covered by existing tests)?
   -->
   
   # Are there any user-facing changes?
   
   <!--
   If there are user-facing changes then we may require documentation to be updated before approving the PR.
   -->
   
   <!--
   If there are any breaking changes to public APIs, please add the `api change` label.
   -->


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] tustvold commented on a diff in pull request #4762: Avoid boxing config keys

Posted by GitBox <gi...@apache.org>.
tustvold commented on code in PR #4762:
URL: https://github.com/apache/arrow-datafusion/pull/4762#discussion_r1058321426


##########
datafusion/core/src/config.rs:
##########
@@ -134,9 +135,9 @@ pub const OPT_HASH_JOIN_SINGLE_PARTITION_THRESHOLD: &str =
 /// Definition of a configuration option
 pub struct ConfigDefinition {
     /// key used to identifier this configuration option
-    key: String,
+    key: Cow<'static, str>,

Review Comment:
   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



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] tustvold closed pull request #4762: Avoid boxing config keys

Posted by GitBox <gi...@apache.org>.
tustvold closed pull request #4762: Avoid boxing config keys
URL: https://github.com/apache/arrow-datafusion/pull/4762


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] alamb commented on a diff in pull request #4762: Avoid boxing config keys

Posted by GitBox <gi...@apache.org>.
alamb commented on code in PR #4762:
URL: https://github.com/apache/arrow-datafusion/pull/4762#discussion_r1058314888


##########
datafusion/core/src/config.rs:
##########
@@ -134,9 +135,9 @@ pub const OPT_HASH_JOIN_SINGLE_PARTITION_THRESHOLD: &str =
 /// Definition of a configuration option
 pub struct ConfigDefinition {
     /// key used to identifier this configuration option
-    key: String,
+    key: Cow<'static, str>,

Review Comment:
   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



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [arrow-datafusion] tustvold commented on pull request #4762: Avoid boxing config keys

Posted by GitBox <gi...@apache.org>.
tustvold commented on PR #4762:
URL: https://github.com/apache/arrow-datafusion/pull/4762#issuecomment-1367599722

   Closing in favour of #4771


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org