|
18 | 18 | --> |
19 | 19 |
|
20 | 20 | <!--- |
21 | | -This file was generated by the dev/update_config_docs.sh script. |
| 21 | +NOTE: This file was generated by the dev/update_config_docs.sh script. |
22 | 22 | Do not edit it manually as changes will be overwritten. |
23 | 23 | Instead, edit dev/update_config_docs.sh or the docstrings in datafusion/core/src/config.rs. |
24 | 24 | --> |
25 | 25 |
|
26 | 26 | # Configuration Settings |
27 | 27 |
|
28 | | -The following configuration options can be passed to `SessionConfig` to control various aspects of query execution. |
| 28 | +DataFusion configurations control various aspects of DataFusion planning and execution |
29 | 29 |
|
30 | | -For applications which do not expose `SessionConfig`, like `datafusion-cli`, these options may also be set via environment variables. |
31 | | -To construct a session with options from the environment, use `SessionConfig::from_env`. |
32 | | -The name of the environment variable is the option's key, transformed to uppercase and with periods replaced with underscores. |
33 | | -For example, to configure `datafusion.execution.batch_size` you would set the `DATAFUSION_EXECUTION_BATCH_SIZE` environment variable. |
34 | | -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). |
35 | | -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. |
36 | | -Environment variables are read during `SessionConfig` initialisation so they must be set beforehand and will not affect running sessions. |
| 30 | +## Setting Configuration Options |
| 31 | + |
| 32 | +### Programmatically |
| 33 | + |
| 34 | +You can set the options programmatically via the [`ConfigOptions`] object. For |
| 35 | +example, to configure the `datafusion.execution.target_partitions` using the API: |
| 36 | + |
| 37 | +```rust |
| 38 | +use datafusion::common::config::ConfigOptions; |
| 39 | +let mut config = ConfigOptions::new(); |
| 40 | +config.execution.target_partitions = 1; |
| 41 | +``` |
| 42 | + |
| 43 | +### Via Environment Variables |
| 44 | + |
| 45 | +You can also set configuration options via environment variables using |
| 46 | +[`ConfigOptions::from_env`], for example |
| 47 | + |
| 48 | +```shell |
| 49 | +DATAFUSION_EXECUTION_TARGET_PARTITIONS=1 ./your_program |
| 50 | +``` |
| 51 | + |
| 52 | +### Via SQL |
| 53 | + |
| 54 | +You can also set configuration options via SQL using the `SET` command. For |
| 55 | +example, to configure `datafusion.execution.target_partitions`: |
| 56 | + |
| 57 | +```sql |
| 58 | +SET datafusion.execution.target_partitions = '1'; |
| 59 | +``` |
| 60 | + |
| 61 | +[`configoptions`]: https://docs.rs/datafusion/latest/datafusion/common/config/struct.ConfigOptions.html |
| 62 | +[`configoptions::from_env`]: https://docs.rs/datafusion/latest/datafusion/common/config/struct.ConfigOptions.html#method.from_env |
| 63 | + |
| 64 | +The following configuration settings are available: |
37 | 65 |
|
38 | 66 | | key | default | description | |
39 | 67 | | ----------------------------------------------------------------------- | ------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
|
0 commit comments