Skip to content

Commit bfaf21b

Browse files
manuzhangcodex
andcommitted
feat: add row delta update
Implements the RowDelta update builder, table and transaction factory methods, and focused tests for row-level add/delete flows. Co-authored-by: Codex <codex@openai.com>
1 parent 6f503f9 commit bfaf21b

14 files changed

Lines changed: 695 additions & 6 deletions

src/iceberg/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ set(ICEBERG_SOURCES
105105
update/merge_append.cc
106106
update/merging_snapshot_update.cc
107107
update/pending_update.cc
108+
update/row_delta.cc
108109
update/set_snapshot.cc
109110
update/snapshot_manager.cc
110111
update/snapshot_update.cc

src/iceberg/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ iceberg_sources = files(
130130
'update/merge_append.cc',
131131
'update/merging_snapshot_update.cc',
132132
'update/pending_update.cc',
133+
'update/row_delta.cc',
133134
'update/set_snapshot.cc',
134135
'update/snapshot_manager.cc',
135136
'update/snapshot_update.cc',

src/iceberg/table.cc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include "iceberg/update/expire_snapshots.h"
3636
#include "iceberg/update/fast_append.h"
3737
#include "iceberg/update/merge_append.h"
38+
#include "iceberg/update/row_delta.h"
3839
#include "iceberg/update/set_snapshot.h"
3940
#include "iceberg/update/snapshot_manager.h"
4041
#include "iceberg/update/update_location.h"
@@ -231,6 +232,12 @@ Result<std::shared_ptr<DeleteFiles>> Table::NewDeleteFiles() {
231232
return DeleteFiles::Make(name().name, std::move(ctx));
232233
}
233234

235+
Result<std::shared_ptr<RowDelta>> Table::NewRowDelta() {
236+
ICEBERG_ASSIGN_OR_RAISE(
237+
auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate));
238+
return RowDelta::Make(name().name, std::move(ctx));
239+
}
240+
234241
Result<std::shared_ptr<UpdateStatistics>> Table::NewUpdateStatistics() {
235242
ICEBERG_ASSIGN_OR_RAISE(
236243
auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate));
@@ -334,6 +341,10 @@ Result<std::shared_ptr<MergeAppend>> StaticTable::NewMergeAppend() {
334341
return NotSupported("Cannot create a merge append for a static table");
335342
}
336343

344+
Result<std::shared_ptr<RowDelta>> StaticTable::NewRowDelta() {
345+
return NotSupported("Cannot create a row delta for a static table");
346+
}
347+
337348
Result<std::shared_ptr<SnapshotManager>> StaticTable::NewSnapshotManager() {
338349
return NotSupported("Cannot create a snapshot manager for a static table");
339350
}

src/iceberg/table.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ class ICEBERG_EXPORT Table : public std::enable_shared_from_this<Table> {
182182
/// \brief Create a new DeleteFiles to delete data files and commit the changes.
183183
virtual Result<std::shared_ptr<DeleteFiles>> NewDeleteFiles();
184184

185+
/// \brief Create a new RowDelta to add rows and row-level deletes.
186+
virtual Result<std::shared_ptr<RowDelta>> NewRowDelta();
187+
185188
/// \brief Create a new SnapshotManager to manage snapshots and snapshot references.
186189
virtual Result<std::shared_ptr<SnapshotManager>> NewSnapshotManager();
187190

@@ -251,6 +254,8 @@ class ICEBERG_EXPORT StaticTable : public Table {
251254

252255
Result<std::shared_ptr<MergeAppend>> NewMergeAppend() override;
253256

257+
Result<std::shared_ptr<RowDelta>> NewRowDelta() override;
258+
254259
Result<std::shared_ptr<SnapshotManager>> NewSnapshotManager() override;
255260

256261
private:

src/iceberg/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -229,6 +229,7 @@ if(ICEBERG_BUILD_BUNDLE)
229229
merge_append_test.cc
230230
merging_snapshot_update_test.cc
231231
name_mapping_update_test.cc
232+
row_delta_test.cc
232233
snapshot_manager_test.cc
233234
transaction_test.cc
234235
update_location_test.cc

0 commit comments

Comments
 (0)