Skip to content
Open
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 @@ -101,6 +101,7 @@ set(ICEBERG_SOURCES
type.cc
update/expire_snapshots.cc
update/fast_append.cc
update/merge_append.cc
update/merging_snapshot_update.cc
update/pending_update.cc
update/set_snapshot.cc
Expand Down
1 change: 1 addition & 0 deletions src/iceberg/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ iceberg_sources = files(
'type.cc',
'update/expire_snapshots.cc',
'update/fast_append.cc',
'update/merge_append.cc',
'update/merging_snapshot_update.cc',
'update/pending_update.cc',
'update/set_snapshot.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 @@ -33,6 +33,7 @@
#include "iceberg/transaction.h"
#include "iceberg/update/expire_snapshots.h"
#include "iceberg/update/fast_append.h"
#include "iceberg/update/merge_append.h"
#include "iceberg/update/set_snapshot.h"
#include "iceberg/update/snapshot_manager.h"
#include "iceberg/update/update_location.h"
Expand Down Expand Up @@ -217,6 +218,12 @@ Result<std::shared_ptr<FastAppend>> Table::NewFastAppend() {
return FastAppend::Make(name().name, std::move(ctx));
}

Result<std::shared_ptr<MergeAppend>> Table::NewMergeAppend() {
ICEBERG_ASSIGN_OR_RAISE(
auto ctx, TransactionContext::Make(shared_from_this(), TransactionKind::kUpdate));
return MergeAppend::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 @@ -316,6 +323,10 @@ Result<std::shared_ptr<FastAppend>> StaticTable::NewFastAppend() {
return NotSupported("Cannot create a fast append for a static table");
}

Result<std::shared_ptr<MergeAppend>> StaticTable::NewMergeAppend() {
return NotSupported("Cannot create a merge append 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 @@ -176,6 +176,9 @@ class ICEBERG_EXPORT Table : public std::enable_shared_from_this<Table> {
/// \brief Create a new FastAppend to append data files and commit the changes.
virtual Result<std::shared_ptr<FastAppend>> NewFastAppend();

/// \brief Create a new MergeAppend to append data files and merge manifests.
virtual Result<std::shared_ptr<MergeAppend>> NewMergeAppend();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

StaticTable also needs to override this and return NotSupported. Otherwise a read-only StaticTable inherits Table::NewMergeAppend(), creates a mutating snapshot update, and later hits the null catalog path during commit. The existing static-table test should cover this alongside NewFastAppend.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


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

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

Result<std::shared_ptr<FastAppend>> NewFastAppend() override;

Result<std::shared_ptr<MergeAppend>> NewMergeAppend() 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 @@ -225,6 +225,7 @@ if(ICEBERG_BUILD_BUNDLE)
expire_snapshots_test.cc
fast_append_test.cc
manifest_filter_manager_test.cc
merge_append_test.cc
merging_snapshot_update_test.cc
name_mapping_update_test.cc
snapshot_manager_test.cc
Expand Down
Loading
Loading