feat: add manifest&manifest list writer#176
Merged
zeroshade merged 14 commits intoapache:mainfrom Sep 3, 2025
Merged
Conversation
wgtmac
reviewed
Aug 15, 2025
HeartLinked
suggested changes
Aug 18, 2025
HeartLinked
reviewed
Aug 19, 2025
src/iceberg/manifest_writer.cc
Outdated
| case 1: | ||
| return std::make_unique<ManifestListWriterV1>(snapshot_id, parent_snapshot_id, | ||
| std::move(writer), std::move(schema)); | ||
| case 2: |
Contributor
There was a problem hiding this comment.
sequence_number is required for V2 manifest list, so here needs check validation for v2?
Member
|
What about this? // Implemented by different versions with different schemas to
// append a list of `ManifestFile`s to an `ArrowArray`.
class ManifestFileAdapter {
public:
virtual Status StartAppending() const = 0;
virtual Status Append(const ManifestFile& file) const = 0;
virtual Result<ArrowArray> FinishAppending() const = 0;
int64_t size() const { return size_; }
private:
std::shared_ptr<Schema> manifest_list_schema_;
ArrowSchema schema_; // converted from manifest_list_schema_
ArrowArray array_; // array to append `ManifestFile`s
int64_t size_;
};
class ICEBERG_EXPORT ManifestListWriter {
public:
static Result<std::unique_ptr<ManifestListWriter>> Make(
std::string_view manifest_list_location, std::shared_ptr<FileIO> file_io,
const std::unordered_map<std::string, std::string>& meta);
Status AddAll(const std::vector<ManifestFile>& files) const {
for (const auto& file : files) {
Add(file);
}
return {};
}
Status Add(const ManifestFile& file) const {
if (adapter_->size() >= kBatchSize) {
ICEBERG_ASSIGN_OR_RAISE(auto array, adapter_->FinishAppending());
ICEBERG_RETURN_UNEXPECTED(writer_->Write(array));
ICEBERG_RETURN_UNEXPECTED(adapter_->StartAppending());
}
return adapter_->Append(file);
}
Status Close() const;
private:
static constexpr int64_t kBatchSize = 1024;
std::unique_ptr<Writer> writer_;
std::unique_ptr<ManifestFileAdapter> adapter_;
}; |
Contributor
Author
The latest patch add a new header for this adapter at src/iceberg/metadata_adapter.h. |
9bbfb78 to
0b17e28
Compare
wgtmac
reviewed
Aug 20, 2025
wgtmac
reviewed
Aug 21, 2025
wgtmac
approved these changes
Aug 26, 2025
added 12 commits
August 27, 2025 10:16
1 add v1v2v3 writer definition 2
HeartLinked
approved these changes
Aug 27, 2025
bd69a16 to
6be5965
Compare
added 2 commits
August 27, 2025 10:35
nullccxsy
approved these changes
Aug 27, 2025
zeroshade
approved these changes
Sep 3, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
1 add v1v2v3 writer definition
2 add v1v2v3 metadata wrapper