Skip to content

Commit 67907a6

Browse files
authored
minor: validate config minimum_parallel_output_files when setting it (#23596)
## 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. --> - Part of #17498 ## 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. --> This is logically the same change as #23592, but for another configuration. This value represents number of concurrent writer, and 0 is a invalid value. So validate it must be non-zero ## 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 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. -->
1 parent 5cd30b1 commit 67907a6

3 files changed

Lines changed: 5 additions & 2 deletions

File tree

datafusion/common/src/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -867,7 +867,7 @@ config_namespace! {
867867
/// RecordBatches will be distributed in round robin fashion to each
868868
/// parallel writer. Each writer is closed and a new file opened once
869869
/// soft_max_rows_per_output_file is reached.
870-
pub minimum_parallel_output_files: usize, default = 4
870+
pub minimum_parallel_output_files: ConfigNonZeroUsize, default = non_zero_usize_default(4)
871871

872872
/// Target number of rows in output files when writing multiple.
873873
/// This is a soft max, so it can be exceeded slightly. There also

datafusion/datasource/src/write/demux.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async fn row_count_demuxer(
155155

156156
let max_rows_per_file = exec_options.soft_max_rows_per_output_file.get();
157157
let max_buffered_batches = exec_options.max_buffered_batches_per_output_file;
158-
let minimum_parallel_files = exec_options.minimum_parallel_output_files;
158+
let minimum_parallel_files = exec_options.minimum_parallel_output_files.get();
159159
let mut part_idx = 0;
160160
let write_id = rand::distr::Alphanumeric.sample_string(&mut rand::rng(), 16);
161161

datafusion/sqllogictest/test_files/set_variable.slt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,9 @@ SET datafusion.runtime.list_files_cache_ttl = '1m18446744073709551556s'
724724
statement error DataFusion error: Invalid or Unsupported Configuration: value must be greater than 0
725725
SET datafusion.execution.batch_size = 0
726726

727+
statement error DataFusion error: Invalid or Unsupported Configuration: value must be greater than 0
728+
SET datafusion.execution.minimum_parallel_output_files = 0
729+
727730
statement error DataFusion error: Invalid or Unsupported Configuration: value must be greater than 0
728731
SET datafusion.execution.soft_max_rows_per_output_file = 0
729732

0 commit comments

Comments
 (0)