Skip to content

Commit 30c3120

Browse files
authored
fix: Assign UUID when creating table metadata (#713)
1 parent 701d39c commit 30c3120

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

src/iceberg/table_metadata.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,8 @@ Result<std::unique_ptr<TableMetadata>> TableMetadata::Make(
224224
ICEBERG_RETURN_UNEXPECTED(PropertyUtil::ValidateCommitProperties(properties));
225225

226226
return TableMetadataBuilder::BuildFromEmpty(format_version)
227-
->SetLocation(location)
227+
->AssignUUID()
228+
.SetLocation(location)
228229
.SetCurrentSchema(std::move(fresh_schema), last_column_id)
229230
.SetDefaultPartitionSpec(std::move(fresh_spec))
230231
.SetDefaultSortOrder(std::move(fresh_order))

src/iceberg/test/table_metadata_builder_test.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
#include "iceberg/test/matchers.h"
3737
#include "iceberg/transform.h"
3838
#include "iceberg/type.h"
39+
#include "iceberg/util/uuid.h"
3940

4041
namespace iceberg {
4142

@@ -102,6 +103,7 @@ TEST(TableMetadataTest, Make) {
102103

103104
ICEBERG_UNWRAP_OR_FAIL(
104105
auto metadata, TableMetadata::Make(*Schema, *spec, *order, "s3://bucket/test", {}));
106+
EXPECT_THAT(Uuid::FromString(metadata->table_uuid), IsOk());
105107
// Check schema fields
106108
ASSERT_EQ(1, metadata->schemas.size());
107109
auto fields = metadata->schemas[0]->fields() | std::ranges::to<std::vector>();

0 commit comments

Comments
 (0)