mapleFU commented on code in PR #36774:
URL: https://github.com/apache/arrow/pull/36774#discussion_r1268338192
##########
cpp/src/parquet/file_reader.cc:
##########
@@ -366,13 +366,19 @@ class SerializedFile : public ParquetFileReader::Contents
{
std::make_shared<::arrow::io::internal::ReadRangeCache>(source_, ctx,
options);
std::vector<::arrow::io::ReadRange> ranges;
prebuffered_column_chunks_.clear();
+ int num_cols = file_metadata_->num_columns();
+ // a bitmap for buffered columns.
+ std::shared_ptr<Buffer> buffer_columns;
+ if (!row_groups.empty()) {
Review Comment:
a possible optimization is that we can regard `nullptr` as buffer the column.
```c++
if (!row_groups.empty()) {
if (num_cols == static_cast<int>(row_groups.size())) {
buffer_columns = nullptr;
} else {
PARQUET_THROW_NOT_OK(AllocateEmptyBitmap(num_cols,
properties_.memory_pool())
.Value(&buffer_columns));
for (int col : column_indices) {
::arrow::bit_util::SetBit(buffer_columns->mutable_data(), col);
}
}
}
```
And if
```
void PreBuffer(const std::vector<int>& row_groups,
const std::vector<int>& column_indices,
const ::arrow::io::IOContext& ctx,
const ::arrow::io::CacheOptions& options)
```
Find that the `buffer` is nullptr, it will just buffer the column.
--
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]