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/11/18 13:51:31 UTC
[GitHub] [arrow-datafusion-python] andygrove opened a new pull request, #76: allow config options to be passed to context
andygrove opened a new pull request, #76:
URL: https://github.com/apache/arrow-datafusion-python/pull/76
# 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.
-->
Closes #.
# 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.
-->
# 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.
-->
# 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-python] andygrove commented on a diff in pull request #76: allow config options to be passed to context
Posted by GitBox <gi...@apache.org>.
andygrove commented on code in PR #76:
URL: https://github.com/apache/arrow-datafusion-python/pull/76#discussion_r1026671246
##########
src/context.rs:
##########
@@ -75,9 +79,23 @@ impl PySessionContext {
repartition_windows: bool,
parquet_pruning: bool,
target_partitions: Option<usize>,
- // TODO: config_options
+ config_options: Option<HashMap<String, String>>,
) -> Self {
- let cfg = SessionConfig::new()
+ let mut options = ConfigOptions::new();
+ if let Some(hash_map) = config_options {
+ for (k, v) in &hash_map {
+ if let Ok(v) = v.parse::<bool>() {
+ options.set(k, ScalarValue::Boolean(Some(v)));
Review Comment:
Good point. I have made that change.
--
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-python] isidentical commented on a diff in pull request #76: allow config options to be passed to context
Posted by GitBox <gi...@apache.org>.
isidentical commented on code in PR #76:
URL: https://github.com/apache/arrow-datafusion-python/pull/76#discussion_r1026638946
##########
src/context.rs:
##########
@@ -75,9 +79,23 @@ impl PySessionContext {
repartition_windows: bool,
parquet_pruning: bool,
target_partitions: Option<usize>,
- // TODO: config_options
+ config_options: Option<HashMap<String, String>>,
) -> Self {
- let cfg = SessionConfig::new()
+ let mut options = ConfigOptions::new();
+ if let Some(hash_map) = config_options {
+ for (k, v) in &hash_map {
+ if let Ok(v) = v.parse::<bool>() {
+ options.set(k, ScalarValue::Boolean(Some(v)));
Review Comment:
Another minor thing is that, since we have branches here (instead of a unified path with `ScalarValue::try_from`; we can use `set_bool()`/`set_u64()`/`set_string()` respectively as an easier way (though it is pretty much the same thing as what you wrote so no strong opinions)
--
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-python] andygrove commented on pull request #76: allow config options to be passed to context
Posted by GitBox <gi...@apache.org>.
andygrove commented on PR #76:
URL: https://github.com/apache/arrow-datafusion-python/pull/76#issuecomment-1320194098
@francis-du @isidentical fyi
--
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-python] andygrove commented on a diff in pull request #76: allow config options to be passed to context
Posted by GitBox <gi...@apache.org>.
andygrove commented on code in PR #76:
URL: https://github.com/apache/arrow-datafusion-python/pull/76#discussion_r1026667441
##########
src/context.rs:
##########
@@ -75,9 +79,23 @@ impl PySessionContext {
repartition_windows: bool,
parquet_pruning: bool,
target_partitions: Option<usize>,
- // TODO: config_options
+ config_options: Option<HashMap<String, String>>,
Review Comment:
Yes, for now .. I wasn't sure how to do it in a type-safe way with Python. It would be good to look at improving this in a follow on PR.
I tried using BuiltInConfig but the data is private so I could not access it from this project.
--
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-python] isidentical commented on a diff in pull request #76: allow config options to be passed to context
Posted by GitBox <gi...@apache.org>.
isidentical commented on code in PR #76:
URL: https://github.com/apache/arrow-datafusion-python/pull/76#discussion_r1026635637
##########
src/context.rs:
##########
@@ -75,9 +79,23 @@ impl PySessionContext {
repartition_windows: bool,
parquet_pruning: bool,
target_partitions: Option<usize>,
- // TODO: config_options
+ config_options: Option<HashMap<String, String>>,
) -> Self {
- let cfg = SessionConfig::new()
+ let mut options = ConfigOptions::new();
Review Comment:
Suggestion: we probably should inherit everything from the current environment, and the passed configurations should override them.
```suggestion
let mut options = ConfigOptions::from_env();
```
##########
src/context.rs:
##########
@@ -75,9 +79,23 @@ impl PySessionContext {
repartition_windows: bool,
parquet_pruning: bool,
target_partitions: Option<usize>,
- // TODO: config_options
+ config_options: Option<HashMap<String, String>>,
Review Comment:
Does this mean we have to pass the stringized versions of rust types as config values? E.g. `{"batch_size": "4096"}` (instead of literal `4096`, or `"true"` instead of `True`). I guess it might be an improvement later (just to keep in mind).
##########
src/context.rs:
##########
@@ -86,6 +104,9 @@ impl PySessionContext {
.with_repartition_windows(repartition_windows)
.with_parquet_pruning(parquet_pruning);
+ // TODO we should add a `with_config_options` to `SessionConfig`
Review Comment:
👍🏻
--
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-python] andygrove merged pull request #76: allow config options to be passed to context
Posted by GitBox <gi...@apache.org>.
andygrove merged PR #76:
URL: https://github.com/apache/arrow-datafusion-python/pull/76
--
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