mapleFU commented on code in PR #37400:
URL: https://github.com/apache/arrow/pull/37400#discussion_r1321341833
##########
cpp/src/parquet/metadata.cc:
##########
@@ -1793,36 +1793,65 @@ class FileMetaDataBuilder::FileMetaDataBuilderImpl {
}
void SetPageIndexLocation(const PageIndexLocation& location) {
- auto set_index_location =
+ auto set_index_location = [this](size_t row_group_ordinal,
+ const FileIndexLocation&
file_index_location,
+ bool column_index) {
+ auto& row_group_metadata = this->row_groups_.at(row_group_ordinal);
+ auto iter = file_index_location.find(row_group_ordinal);
+ if (iter != file_index_location.cend()) {
+ const auto& row_group_index_location = iter->second;
+ for (size_t i = 0; i < row_group_index_location.size(); ++i) {
+ if (i >= row_group_metadata.columns.size()) {
+ throw ParquetException("Cannot find metadata for column ordinal ",
i);
+ }
+ auto& column_metadata = row_group_metadata.columns.at(i);
+ const auto& index_location = row_group_index_location.at(i);
+ if (index_location.has_value()) {
+ if (column_index) {
+
column_metadata.__set_column_index_offset(index_location->offset);
+
column_metadata.__set_column_index_length(index_location->length);
+ } else {
+
column_metadata.__set_offset_index_offset(index_location->offset);
+
column_metadata.__set_offset_index_length(index_location->length);
+ }
+ }
+ }
+ }
+ };
+
+ for (size_t i = 0; i < row_groups_.size(); ++i) {
+ set_index_location(i, location.column_index_location, true);
+ set_index_location(i, location.offset_index_location, false);
+ }
+ }
+
+ // Update location to all bloom filters in the parquet file.
+ void SetBloomFilterLocation(const BloomFilterLocation& location) {
+ auto set_bloom_filter_location =
[this](size_t row_group_ordinal,
- const PageIndexLocation::FileIndexLocation& file_index_location,
- bool column_index) {
+ const FileIndexLocation& file_bloom_filter_location) {
auto& row_group_metadata = this->row_groups_.at(row_group_ordinal);
- auto iter = file_index_location.find(row_group_ordinal);
- if (iter != file_index_location.cend()) {
- const auto& row_group_index_location = iter->second;
- for (size_t i = 0; i < row_group_index_location.size(); ++i) {
+ auto iter = file_bloom_filter_location.find(row_group_ordinal);
+ if (iter != file_bloom_filter_location.cend()) {
+ const auto& row_group_bloom_filter_location = iter->second;
+ for (size_t i = 0; i < row_group_bloom_filter_location.size();
++i) {
if (i >= row_group_metadata.columns.size()) {
Review Comment:
Change to DCHECK now
--
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]