wgtmac commented on code in PR #38158:
URL: https://github.com/apache/arrow/pull/38158#discussion_r1351138395
##########
cpp/src/parquet/encoding.cc:
##########
@@ -1156,16 +1160,21 @@ inline int PlainBooleanDecoder::DecodeArrow(
int PlainBooleanDecoder::Decode(uint8_t* buffer, int max_values) {
max_values = std::min(max_values, num_values_);
- bool val;
+ constexpr int kBatchSize = 1024;
+ std::array<bool, kBatchSize> bit_read_scratch;
::arrow::internal::BitmapWriter bit_writer(buffer, 0, max_values);
- for (int i = 0; i < max_values; ++i) {
- if (!bit_reader_->GetValue(1, &val)) {
+ for (int i = 0; i < max_values; i += kBatchSize) {
+ int batch_size = std::min(max_values - i, kBatchSize);
+ if (bit_reader_->GetBatch(/*num_bits=*/1, bit_read_scratch.data(),
batch_size) !=
+ batch_size) {
ParquetException::EofException();
}
- if (val) {
- bit_writer.Set();
+ for (int j = 0; j < batch_size; ++j) {
+ if (bit_read_scratch[j]) {
+ bit_writer.Set();
Review Comment:
It seems that bit writer has the chance to accept batch write.
--
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]