-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Docs: Add Examples to Config Options page #17039
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -50,22 +50,49 @@ cat <<'EOF' > "$TARGET_FILE" | |
| --> | ||
|
|
||
| <!--- | ||
| This file was generated by the dev/update_config_docs.sh script. | ||
| NOTE: This file was generated by the dev/update_config_docs.sh script. | ||
| Do not edit it manually as changes will be overwritten. | ||
| Instead, edit dev/update_config_docs.sh or the docstrings in datafusion/core/src/config.rs. | ||
| --> | ||
|
|
||
| # Configuration Settings | ||
|
|
||
| The following configuration options can be passed to `SessionConfig` to control various aspects of query execution. | ||
| DataFusion configurations control various aspects of DataFusion planning and execution | ||
|
|
||
| For applications which do not expose `SessionConfig`, like `datafusion-cli`, these options may also be set via environment variables. | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this content is moved into ConfigOptions docs |
||
| To construct a session with options from the environment, use `SessionConfig::from_env`. | ||
| The name of the environment variable is the option's key, transformed to uppercase and with periods replaced with underscores. | ||
| For example, to configure `datafusion.execution.batch_size` you would set the `DATAFUSION_EXECUTION_BATCH_SIZE` environment variable. | ||
| Values are parsed according to the [same rules used in casts from Utf8](https://docs.rs/arrow/latest/arrow/compute/kernels/cast/fn.cast.html). | ||
| If the value in the environment variable cannot be cast to the type of the configuration option, the default value will be used instead and a warning emitted. | ||
| Environment variables are read during `SessionConfig` initialisation so they must be set beforehand and will not affect running sessions. | ||
| ## Setting Configuration Options | ||
|
|
||
| ### Programmatically | ||
| You can set the options programmatically via the [`ConfigOptions`] object. For | ||
| example, to configure the `datafusion.execution.target_partitions` using the API: | ||
|
|
||
| ```rust | ||
| use datafusion::common::config::ConfigOptions; | ||
| let mut config = ConfigOptions::new(); | ||
| config.execution.target_partitions = 1; | ||
| ``` | ||
|
|
||
| ### Via Environment Variables | ||
|
|
||
| You can also set configuration options via environment variables using | ||
| [`ConfigOptions::from_env`], for example | ||
|
|
||
| ```shell | ||
| DATAFUSION_EXECUTION_TARGET_PARTITIONS=1 ./your_program | ||
| ``` | ||
|
|
||
| ### Via SQL | ||
|
|
||
| You can also set configuration options via SQL using the `SET` command. For | ||
| example, to configure `datafusion.execution.target_partitions`: | ||
|
|
||
| ```sql | ||
| SET datafusion.execution.target_partitions = '1'; | ||
| ``` | ||
|
|
||
| [`ConfigOptions`]: https://docs.rs/datafusion/latest/datafusion/common/config/struct.ConfigOptions.html | ||
| [`ConfigOptions::from_env`]: https://docs.rs/datafusion/latest/datafusion/common/config/struct.ConfigOptions.html#method.from_env | ||
|
|
||
| The following configuration settings are available: | ||
|
|
||
| EOF | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This information was previously in the user guide but it feels like code level details so I moved it