mapleFU commented on code in PR #38784:
URL: https://github.com/apache/arrow/pull/38784#discussion_r1403560899


##########
cpp/src/parquet/encoding.cc:
##########
@@ -1196,15 +1196,22 @@ struct ArrowBinaryHelper<ByteArrayType> {
         chunk_space_remaining_(::arrow::kBinaryMemoryLimit -
                                acc_->builder->value_data_length()) {}
 
+  // Prepare will reserve the number of entries remaining in the current chunk.
+  // If estimated_data_length is provided, it will also reserve the estimated 
data length,
+  // and the caller should better call `UnsafeAppend` instead of `Append` to 
avoid
+  // double-checking the data length.
   Status Prepare(std::optional<int64_t> estimated_data_length = {}) {
     RETURN_NOT_OK(acc_->builder->Reserve(entries_remaining_));
     if (estimated_data_length.has_value()) {
       RETURN_NOT_OK(acc_->builder->ReserveData(
-          std::min<int64_t>(*estimated_data_length, 
::arrow::kBinaryMemoryLimit)));
+          std::min<int64_t>(*estimated_data_length, 
this->chunk_space_remaining_)));

Review Comment:
   Using `::arrow::kBinaryMemoryLimit` is too large here.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to