lidavidm commented on a change in pull request #9972: URL: https://github.com/apache/arrow/pull/9972#discussion_r660563003
########## File path: cpp/src/arrow/dataset/file_base.cc ########## @@ -451,7 +451,12 @@ Status WriteNextBatch(WriteState* state, const std::shared_ptr<Fragment>& fragme ARROW_ASSIGN_OR_RAISE(auto groups, state->write_options.partitioning->Partition(batch)); batch.reset(); // drop to hopefully conserve memory - if (groups.batches.size() > static_cast<size_t>(state->write_options.max_partitions)) { + if (state.write_options.max_partitions <= 0) { + return Status::Invalid("max_partitions must be positive (was ", + state.write_options.max_partitions, ")"); + } + + if (groups.batches.size() > static_cast<size_t>(state.write_options.max_partitions)) { Review comment: ```suggestion if (state->write_options.max_partitions <= 0) { return Status::Invalid("max_partitions must be positive (was ", state->write_options.max_partitions, ")"); } if (groups.batches.size() > static_cast<size_t>(state->write_options.max_partitions)) { ``` ########## File path: cpp/src/arrow/dataset/file_base.cc ########## @@ -451,7 +451,12 @@ Status WriteNextBatch(WriteState* state, const std::shared_ptr<Fragment>& fragme ARROW_ASSIGN_OR_RAISE(auto groups, state->write_options.partitioning->Partition(batch)); batch.reset(); // drop to hopefully conserve memory - if (groups.batches.size() > static_cast<size_t>(state->write_options.max_partitions)) { + if (state.write_options.max_partitions <= 0) { + return Status::Invalid("max_partitions must be positive (was ", + state.write_options.max_partitions, ")"); + } + + if (groups.batches.size() > static_cast<size_t>(state.write_options.max_partitions)) { Review comment: Just to fix the build errors. -- 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-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org