mapleFU commented on code in PR #39337:
URL: https://github.com/apache/arrow/pull/39337#discussion_r1445626038
##########
cpp/src/parquet/metadata.cc:
##########
@@ -793,26 +793,29 @@ class FileMetaData::FileMetaDataImpl {
std::shared_ptr<FileMetaData> out(new FileMetaData());
out->impl_ = std::make_unique<FileMetaDataImpl>();
- out->impl_->metadata_ = std::make_unique<format::FileMetaData>();
-
- auto metadata = out->impl_->metadata_.get();
- metadata->version = metadata_->version;
- metadata->schema = metadata_->schema;
+ {
+ // GH-39336: Copy the metadata, but only the row groups we need.
+ auto temp_row_groups = std::move(this->metadata_->row_groups);
+ try {
Review Comment:
I think `make_unique` and copying might throw exception( like
`std::bad_alloc`), and even when ex is thrown, we'd better keep `this` not
changed (otherwise it would be hard to debugging?)
--
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]