Skip to content

Commit 7dd826c

Browse files
committed
feat: update partition spec
1 parent b8edbdf commit 7dd826c

16 files changed

Lines changed: 1681 additions & 100 deletions

src/iceberg/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ set(ICEBERG_SOURCES
7777
transform_function.cc
7878
type.cc
7979
update/pending_update.cc
80-
update/update_sort_order.cc
80+
update/update_partition_spec.cc
8181
update/update_properties.cc
82+
update/update_sort_order.cc
8283
util/bucket_util.cc
8384
util/conversions.cc
8485
util/decimal.cc

src/iceberg/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ iceberg_sources = files(
9999
'transform_function.cc',
100100
'type.cc',
101101
'update/pending_update.cc',
102+
'update/update_partition_spec.cc',
102103
'update/update_properties.cc',
103104
'update/update_sort_order.cc',
104105
'util/bucket_util.cc',

src/iceberg/table.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919

2020
#include "iceberg/table.h"
2121

22+
#include <memory>
23+
2224
#include "iceberg/catalog.h"
2325
#include "iceberg/partition_spec.h"
2426
#include "iceberg/result.h"
@@ -28,6 +30,7 @@
2830
#include "iceberg/table_properties.h"
2931
#include "iceberg/table_scan.h"
3032
#include "iceberg/transaction.h"
33+
#include "iceberg/update/update_partition_spec.h"
3134
#include "iceberg/update/update_properties.h"
3235
#include "iceberg/util/macros.h"
3336

@@ -147,6 +150,13 @@ Result<std::shared_ptr<Transaction>> Table::NewTransaction() {
147150
/*auto_commit=*/false);
148151
}
149152

153+
Result<std::shared_ptr<UpdatePartitionSpec>> Table::NewUpdateSpec() {
154+
ICEBERG_ASSIGN_OR_RAISE(
155+
auto transaction, Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate,
156+
/*auto_commit=*/true));
157+
return transaction->NewUpdateSpec();
158+
}
159+
150160
Result<std::shared_ptr<UpdateProperties>> Table::NewUpdateProperties() {
151161
ICEBERG_ASSIGN_OR_RAISE(
152162
auto transaction, Transaction::Make(shared_from_this(), Transaction::Kind::kUpdate,

src/iceberg/table.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ class ICEBERG_EXPORT Table : public std::enable_shared_from_this<Table> {
128128
/// \brief Create a new Transaction to commit multiple table operations at once.
129129
virtual Result<std::shared_ptr<Transaction>> NewTransaction();
130130

131+
/// \brief Create a new UpdatePartitionSpec to update the partition spec of this table
132+
/// and commit the changes.
133+
virtual Result<std::shared_ptr<UpdatePartitionSpec>> NewUpdateSpec();
134+
131135
/// \brief Create a new UpdateProperties to update table properties and commit the
132136
/// changes.
133137
virtual Result<std::shared_ptr<UpdateProperties>> NewUpdateProperties();

src/iceberg/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ if(ICEBERG_BUILD_BUNDLE)
154154
USE_BUNDLE
155155
SOURCES
156156
transaction_test.cc
157+
update_partition_spec_test.cc
157158
update_properties_test.cc
158159
update_sort_order_test.cc)
159160

0 commit comments

Comments
 (0)