Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/iceberg/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ set(ICEBERG_SOURCES
update/merging_snapshot_update.cc
update/overwrite_files.cc
update/pending_update.cc
update/rewrite_manifests.cc
update/row_delta.cc
update/set_snapshot.cc
update/snapshot_manager.cc
Expand Down
7 changes: 7 additions & 0 deletions src/iceberg/manifest/rolling_manifest_writer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,13 @@ Status RollingManifestWriter::WriteExistingEntry(
return {};
}

Status RollingManifestWriter::WriteExistingEntry(const ManifestEntry& entry) {
ICEBERG_ASSIGN_OR_RAISE(auto* writer, CurrentWriter());
ICEBERG_RETURN_UNEXPECTED(writer->WriteExistingEntry(entry));
current_file_rows_++;
return {};
}

Status RollingManifestWriter::WriteDeletedEntry(
std::shared_ptr<DataFile> file, int64_t data_sequence_number,
std::optional<int64_t> file_sequence_number) {
Expand Down
3 changes: 3 additions & 0 deletions src/iceberg/manifest/rolling_manifest_writer.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ class ICEBERG_EXPORT RollingManifestWriter {
int64_t data_sequence_number,
std::optional<int64_t> file_sequence_number = std::nullopt);

/// \brief Add an existing entry while preserving snapshot and sequence fields.
Status WriteExistingEntry(const ManifestEntry& entry);

/// \brief Add a delete entry for a file.
///
/// \param file a deleted data file
Expand Down
1 change: 1 addition & 0 deletions src/iceberg/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ iceberg_sources = files(
'update/merging_snapshot_update.cc',
'update/overwrite_files.cc',
'update/pending_update.cc',
'update/rewrite_manifests.cc',
'update/row_delta.cc',
'update/set_snapshot.cc',
'update/snapshot_manager.cc',
Expand Down
11 changes: 11 additions & 0 deletions src/iceberg/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
#include "iceberg/update/fast_append.h"
#include "iceberg/update/merge_append.h"
#include "iceberg/update/overwrite_files.h"
#include "iceberg/update/rewrite_manifests.h"
#include "iceberg/update/row_delta.h"
#include "iceberg/update/set_snapshot.h"
#include "iceberg/update/snapshot_manager.h"
Expand Down Expand Up @@ -245,6 +246,12 @@ Result<std::shared_ptr<OverwriteFiles>> Table::NewOverwrite() {
return OverwriteFiles::Make(name().name, std::move(ctx));
}

Result<std::shared_ptr<RewriteManifests>> Table::NewRewriteManifests() {
ICEBERG_ASSIGN_OR_RAISE(
auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate));
return RewriteManifests::Make(name().name, std::move(ctx));
}

Result<std::shared_ptr<UpdateStatistics>> Table::NewUpdateStatistics() {
ICEBERG_ASSIGN_OR_RAISE(
auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate));
Expand Down Expand Up @@ -360,6 +367,10 @@ Result<std::shared_ptr<OverwriteFiles>> StaticTable::NewOverwrite() {
return NotSupported("Cannot create an overwrite for a static table");
}

Result<std::shared_ptr<RewriteManifests>> StaticTable::NewRewriteManifests() {
return NotSupported("Cannot create a rewrite manifests for a static table");
}

Result<std::shared_ptr<SnapshotManager>> StaticTable::NewSnapshotManager() {
return NotSupported("Cannot create a snapshot manager for a static table");
}
Expand Down
5 changes: 5 additions & 0 deletions src/iceberg/table.h
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@ class ICEBERG_EXPORT Table : public std::enable_shared_from_this<Table> {
/// \brief Create a new OverwriteFiles to overwrite data files and commit the changes.
virtual Result<std::shared_ptr<OverwriteFiles>> NewOverwrite();

/// \brief Create a new RewriteManifests to rewrite manifest layout.
virtual Result<std::shared_ptr<RewriteManifests>> NewRewriteManifests();

/// \brief Create a new SnapshotManager to manage snapshots and snapshot references.
virtual Result<std::shared_ptr<SnapshotManager>> NewSnapshotManager();

Expand Down Expand Up @@ -263,6 +266,8 @@ class ICEBERG_EXPORT StaticTable : public Table {

Result<std::shared_ptr<OverwriteFiles>> NewOverwrite() override;

Result<std::shared_ptr<RewriteManifests>> NewRewriteManifests() override;

Result<std::shared_ptr<SnapshotManager>> NewSnapshotManager() override;

private:
Expand Down
1 change: 1 addition & 0 deletions src/iceberg/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ if(ICEBERG_BUILD_BUNDLE)
merge_append_test.cc
merging_snapshot_update_test.cc
name_mapping_update_test.cc
rewrite_manifests_test.cc
row_delta_test.cc
snapshot_manager_test.cc
transaction_test.cc
Expand Down
Loading