pitrou commented on code in PR #40876:
URL: https://github.com/apache/arrow/pull/40876#discussion_r1548261474
##########
cpp/src/parquet/encoding.cc:
##########
@@ -1188,19 +1190,37 @@ int PlainBooleanDecoder::DecodeArrow(
typename EncodingTraits<BooleanType>::Accumulator* builder) {
int values_decoded = num_values - null_count;
if (ARROW_PREDICT_FALSE(num_values_ < values_decoded)) {
+ // A too large `num_values` was requested.
+ ParquetException::EofException();
+ }
+ if (ARROW_PREDICT_FALSE(!bit_reader_->Advance(values_decoded))) {
ParquetException::EofException();
}
- PARQUET_THROW_NOT_OK(builder->Reserve(num_values));
-
- VisitNullBitmapInline(
- valid_bits, valid_bits_offset, num_values, null_count,
- [&]() {
- bool value;
- ARROW_IGNORE_EXPR(bit_reader_->GetValue(1, &value));
- builder->UnsafeAppend(value);
- },
- [&]() { builder->UnsafeAppendNull(); });
+ if (null_count == 0) {
+ // FastPath: can copy the data directly
+ PARQUET_THROW_NOT_OK(builder->AppendValues(data_, values_decoded, NULLPTR,
+ total_num_values_ -
num_values_));
+ } else {
+ int64_t previous_offset = 0;
+ int64_t previous_value_offset = 0;
+ PARQUET_THROW_NOT_OK(::arrow::internal::VisitSetBitRuns(
Review Comment:
The benchmarks in this PR always have null_probability = 0, right?
--
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]