HeartLinked commented on code in PR #345:
URL: https://github.com/apache/iceberg-cpp/pull/345#discussion_r2584401104


##########
src/iceberg/test/table_update_test.cc:
##########
@@ -56,35 +67,377 @@ std::unique_ptr<TableMetadata> CreateBaseMetadata() {
   metadata->location = "s3://bucket/test";
   metadata->last_sequence_number = 0;
   metadata->last_updated_ms = TimePointMs{std::chrono::milliseconds(1000)};
-  metadata->last_column_id = 0;
+  metadata->last_column_id = 3;
+  metadata->current_schema_id = 0;
+  metadata->schemas.push_back(CreateTestSchema());
   metadata->default_spec_id = PartitionSpec::kInitialSpecId;
   metadata->last_partition_id = 0;
   metadata->current_snapshot_id = Snapshot::kInvalidSnapshotId;
   metadata->default_sort_order_id = SortOrder::kInitialSortOrderId;
+  metadata->sort_orders.push_back(SortOrder::Unsorted());
   metadata->next_row_id = TableMetadata::kInitialRowId;
   return metadata;
 }
 
 }  // namespace
 
-// Test GenerateRequirements for AssignUUID update
+// Test AssignUUID
+TEST(TableMetadataBuilderTest, AssignUUIDApplyUpdate) {
+  auto base = CreateBaseMetadata();
+  auto builder = TableMetadataBuilder::BuildFrom(base.get());
+
+  // Apply AssignUUID update
+  table::AssignUUID uuid_update("apply-uuid");
+  uuid_update.ApplyTo(*builder);
+
+  ICEBERG_UNWRAP_OR_FAIL(auto metadata, builder->Build());
+  EXPECT_EQ(metadata->table_uuid, "apply-uuid");
+}
+
 TEST(TableUpdateTest, AssignUUIDGenerateRequirements) {
   table::AssignUUID update("new-uuid");
 
   // New table - no requirements (AssignUUID doesn't generate requirements)
   auto new_table_reqs = GenerateRequirements(update, nullptr);
   EXPECT_TRUE(new_table_reqs.empty());
 
-  // Existing table - AssignUUID doesn't generate requirements anymore
-  // The UUID assertion is added by ForUpdateTable/ForReplaceTable methods
+  // Existing table - no requirements
+  auto base = CreateBaseMetadata();
+  auto existing_table_reqs = GenerateRequirements(update, base.get());
+  EXPECT_TRUE(existing_table_reqs.empty());
+}
+
+// Test UpgradeFormatVersion
+TEST(TableUpdateTest, UpgradeFormatVersionGenerateRequirements) {

Review Comment:
   Yes, I've open another PR #385 for changes about table requirement context.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to