zhjwpku commented on code in PR #317:
URL: https://github.com/apache/iceberg-cpp/pull/317#discussion_r2556352412
##########
src/iceberg/manifest_adapter.cc:
##########
@@ -161,6 +164,110 @@ ManifestEntryAdapter::~ManifestEntryAdapter() {
}
}
+Status ManifestEntryAdapter::AddEntry(ManifestEntry& entry) {
+ ICEBERG_RETURN_UNEXPECTED(CheckDataFile(*entry.data_file));
+ entry.status = ManifestStatus::kAdded;
+ entry.snapshot_id = snapshot_id_;
+ if (entry.sequence_number.has_value() &&
+ entry.sequence_number.value() < TableMetadata::kInitialSequenceNumber) {
+ entry.sequence_number = std::nullopt;
+ }
+ entry.file_sequence_number = std::nullopt;
+ return AddEntryInternal(entry);
+}
+
+Status ManifestEntryAdapter::AddDeleteEntry(ManifestEntry& entry) {
+ ICEBERG_RETURN_UNEXPECTED(CheckDataFile(*entry.data_file));
+ entry.status = ManifestStatus::kDeleted;
+ entry.snapshot_id = snapshot_id_;
+ return AddEntryInternal(entry);
+}
+
+Status ManifestEntryAdapter::AddExistingEntry(ManifestEntry& entry) {
+ ICEBERG_RETURN_UNEXPECTED(CheckDataFile(*entry.data_file));
+ entry.status = ManifestStatus::kExisting;
+ return AddEntryInternal(entry);
+}
+
+ManifestFile ManifestEntryAdapter::ToManifestFile() const {
+ ManifestFile manifest_file;
+ manifest_file.partition_spec_id = partition_spec_->spec_id();
+ manifest_file.content = content_;
+ // sequence_number and min_sequence_number with kInvalidSequenceNumber will
be
+ // replace with real sequence number in `ManifestListWriter`.
+ manifest_file.sequence_number = TableMetadata::kInvalidSequenceNumber;
+ manifest_file.min_sequence_number =
+ min_sequence_number_.value_or(TableMetadata::kInvalidSequenceNumber);
+ manifest_file.existing_files_count = existing_files_count_;
+ manifest_file.added_snapshot_id =
snapshot_id_.value_or(Snapshot::kInvalidSnapshotId);
+ manifest_file.added_files_count = add_files_count_;
+ manifest_file.existing_files_count = existing_files_count_;
+ manifest_file.deleted_files_count = delete_files_count_;
+ manifest_file.added_rows_count = add_rows_count_;
+ manifest_file.existing_rows_count = existing_rows_count_;
+ manifest_file.deleted_rows_count = delete_rows_count_;
+ manifest_file.partitions = std::move(partition_summary_->Summaries());
Review Comment:
This has been changed to:
```
ICEBERG_ASSIGN_OR_RAISE(auto partition_summary,
partition_summary_->Summaries());
manifest_file.partitions = std::move(partition_summary);
```
I agree at the version of you comment, the `move` is not necessary, I guess
meson build would warn under warning_level=2. But after changing, the `move`
can avoid an extra copy.
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]