mapleFU commented on code in PR #34526:
URL: https://github.com/apache/arrow/pull/34526#discussion_r1138834639
##########
cpp/src/arrow/util/rle_encoding.h:
##########
@@ -209,8 +209,7 @@ class RleEncoder {
// bit-packed repeated value
int min_repeated_run_size =
1 + static_cast<int>(::arrow::bit_util::BytesForBits(bit_width));
- int repeated_max_size =
static_cast<int>(::arrow::bit_util::CeilDiv(num_values, 8)) *
- min_repeated_run_size;
Review Comment:
Nope, in fact, `static_cast<int>(::arrow::bit_util::CeilDiv(num_values, 8))`
has occured twice, so for simplify, I rename it
##########
cpp/src/parquet/encoding.cc:
##########
@@ -466,6 +465,15 @@ struct DictEncoderTraits<FLBAType> {
// Initially 1024 elements
static constexpr int32_t kInitialHashTableSize = 1 << 10;
+int RlePreserveBufferSize(int num_values, int bit_width) {
+ // Note: because of the way RleEncoder::CheckBufferFull() is called, we have
to
+ // reserve
+ // an extra "RleEncoder::MinBufferSize" bytes. These extra bytes won't be
used
+ // but not reserving them would cause the encoder to fail.
+ return 1 + ::arrow::util::RleEncoder::MaxBufferSize(bit_width, num_values) +
+ ::arrow::util::RleEncoder::MinBufferSize(bit_width);
Review Comment:
int64_t seems ok, but previously, the code using `RlePreserveBufferSize`
never do a overflow checking. So I use int here.
What do you mean by creating local variable?
--
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]