wgtmac commented on code in PR #47090: URL: https://github.com/apache/arrow/pull/47090#discussion_r2217354312
########## cpp/src/parquet/column_writer.cc: ########## @@ -1150,61 +1150,62 @@ void ColumnWriterImpl::FlushBufferedDataPages() { // ---------------------------------------------------------------------- // TypedColumnWriter -template <typename Action> -inline void DoInBatches(int64_t total, int64_t batch_size, Action&& action) { - int64_t num_batches = static_cast<int>(total / batch_size); - for (int round = 0; round < num_batches; round++) { - action(round * batch_size, batch_size, /*check_page_size=*/true); - } - // Write the remaining values - if (total % batch_size > 0) { - action(num_batches * batch_size, total % batch_size, /*check_page_size=*/true); - } -} - template <typename Action> inline void DoInBatches(const int16_t* def_levels, const int16_t* rep_levels, int64_t num_levels, int64_t batch_size, Action&& action, - bool pages_change_on_record_boundaries) { - if (!pages_change_on_record_boundaries || !rep_levels) { - // If rep_levels is null, then we are writing a non-repeated column. - // In this case, every record contains only one level. - return DoInBatches(num_levels, batch_size, std::forward<Action>(action)); - } - + bool pages_change_on_record_boundaries, int64_t max_rows_per_page, + const std::function<int64_t()>& curr_page_buffered_rows) { Review Comment: Good point. I have changed to follow this style. -- 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