mapleFU commented on code in PR #39337:
URL: https://github.com/apache/arrow/pull/39337#discussion_r1434666050
##########
cpp/src/parquet/metadata.cc:
##########
@@ -793,26 +793,19 @@ class FileMetaData::FileMetaDataImpl {
std::shared_ptr<FileMetaData> out(new FileMetaData());
out->impl_ = std::make_unique<FileMetaDataImpl>();
- out->impl_->metadata_ = std::make_unique<format::FileMetaData>();
+ out->impl_->metadata_ = std::make_unique<format::FileMetaData>(*metadata_);
+ auto output_metadata = out->impl_->metadata_.get();
- auto metadata = out->impl_->metadata_.get();
- metadata->version = metadata_->version;
- metadata->schema = metadata_->schema;
-
- metadata->row_groups.resize(row_groups.size());
+ // Discard row groups that are not in the subset
+ output_metadata->num_rows = 0;
+ output_metadata->row_groups.clear();
Review Comment:
Note:
Here will introduce a more round for copying `metadata_->row_groups`.
Should I:
```
bool isset_rowgroup = metadata->isset.row_groups;
metadata->isset.row_groups = false;
auto row_groups = std::move(metadata->row_groups);
// Copying thrift
// ...
// Assign row_groups back
metadata->row_groups = std::move(row_groups);
metadata->isset.row_groups = ...
// .. Handle RowGroups
```
? cc @wgtmac @pitrou
--
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]