Skip to content

Commit 82a4047

Browse files
committed
feat: add merge append
While adding merge append tests, it was discovered that FastAppend did not populate manifest count summary fields, thus add SnapshotUpdate::BuildManifestCountSummary and use it from FastAppend and MergingSnapshotUpdate, which is consistent with java implementation.
1 parent ae29c3d commit 82a4047

16 files changed

Lines changed: 1697 additions & 16 deletions

src/iceberg/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ set(ICEBERG_SOURCES
9696
type.cc
9797
update/expire_snapshots.cc
9898
update/fast_append.cc
99+
update/merge_append.cc
99100
update/merging_snapshot_update.cc
100101
update/pending_update.cc
101102
update/set_snapshot.cc

src/iceberg/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ iceberg_sources = files(
118118
'type.cc',
119119
'update/expire_snapshots.cc',
120120
'update/fast_append.cc',
121+
'update/merge_append.cc',
121122
'update/merging_snapshot_update.cc',
122123
'update/pending_update.cc',
123124
'update/set_snapshot.cc',

src/iceberg/table.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
#include "iceberg/transaction.h"
3434
#include "iceberg/update/expire_snapshots.h"
3535
#include "iceberg/update/fast_append.h"
36+
#include "iceberg/update/merge_append.h"
3637
#include "iceberg/update/set_snapshot.h"
3738
#include "iceberg/update/snapshot_manager.h"
3839
#include "iceberg/update/update_location.h"
@@ -217,6 +218,12 @@ Result<std::shared_ptr<FastAppend>> Table::NewFastAppend() {
217218
return FastAppend::Make(name().name, std::move(ctx));
218219
}
219220

221+
Result<std::shared_ptr<MergeAppend>> Table::NewMergeAppend() {
222+
ICEBERG_ASSIGN_OR_RAISE(
223+
auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate));
224+
return MergeAppend::Make(name().name, std::move(ctx));
225+
}
226+
220227
Result<std::shared_ptr<UpdateStatistics>> Table::NewUpdateStatistics() {
221228
ICEBERG_ASSIGN_OR_RAISE(
222229
auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate));

src/iceberg/table.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,9 @@ class ICEBERG_EXPORT Table : public std::enable_shared_from_this<Table> {
176176
/// \brief Create a new FastAppend to append data files and commit the changes.
177177
virtual Result<std::shared_ptr<FastAppend>> NewFastAppend();
178178

179+
/// \brief Create a new MergeAppend to append data files and merge manifests.
180+
virtual Result<std::shared_ptr<MergeAppend>> NewMergeAppend();
181+
179182
/// \brief Create a new SnapshotManager to manage snapshots and snapshot references.
180183
virtual Result<std::shared_ptr<SnapshotManager>> NewSnapshotManager();
181184

src/iceberg/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ if(ICEBERG_BUILD_BUNDLE)
218218
expire_snapshots_test.cc
219219
fast_append_test.cc
220220
manifest_filter_manager_test.cc
221+
merge_append_test.cc
221222
merging_snapshot_update_test.cc
222223
name_mapping_update_test.cc
223224
snapshot_manager_test.cc

0 commit comments

Comments
 (0)