wgtmac commented on code in PR #385:
URL: https://github.com/apache/iceberg-cpp/pull/385#discussion_r2587248625


##########
src/iceberg/table_update.cc:
##########
@@ -135,16 +133,16 @@ void AddSnapshot::ApplyTo(TableMetadataBuilder& builder) 
const {
   throw IcebergError(std::format("{} not implemented", __FUNCTION__));
 }
 
-Status AddSnapshot::GenerateRequirements(TableUpdateContext& context) const {
-  return NotImplemented("AddTableSnapshot::GenerateRequirements not 
implemented");
+void AddSnapshot::GenerateRequirements(TableUpdateContext& context) const {
+  // AddSnapshot doesn't generate any requirements
 }
 
 // RemoveSnapshots
 
 void RemoveSnapshots::ApplyTo(TableMetadataBuilder& builder) const {}
 
-Status RemoveSnapshots::GenerateRequirements(TableUpdateContext& context) 
const {
-  return NotImplemented("RemoveTableSnapshots::GenerateRequirements not 
implemented");
+void RemoveSnapshots::GenerateRequirements(TableUpdateContext& context) const {
+  throw IcebergError("RemoveTableSnapshots::GenerateRequirements not 
implemented");

Review Comment:
   ```suggestion
   ```



##########
src/iceberg/table_update.cc:
##########
@@ -163,8 +161,8 @@ void SetSnapshotRef::ApplyTo(TableMetadataBuilder& builder) 
const {
   throw IcebergError(std::format("{} not implemented", __FUNCTION__));
 }
 
-Status SetSnapshotRef::GenerateRequirements(TableUpdateContext& context) const 
{
-  return NotImplemented("SetTableSnapshotRef::GenerateRequirements not 
implemented");
+void SetSnapshotRef::GenerateRequirements(TableUpdateContext& context) const {
+  throw NotImplemented("SetTableSnapshotRef::GenerateRequirements not 
implemented");

Review Comment:
   ```suggestion
   ```



##########
src/iceberg/test/table_requirements_test.cc:
##########
@@ -47,16 +48,47 @@ std::unique_ptr<TableMetadata> CreateBaseMetadata(
   metadata->last_sequence_number = 0;
   metadata->last_updated_ms = TimePointMs{std::chrono::milliseconds(1000)};
   metadata->last_column_id = 0;
+  metadata->current_schema_id = Schema::kInitialSchemaId;
   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->default_sort_order_id = SortOrder::kUnsortedOrderId;
   metadata->next_row_id = TableMetadata::kInitialRowId;
   return metadata;
 }
 
+// Helper function to create a simple schema for tests
+std::shared_ptr<Schema> CreateTestSchema(int32_t schema_id = 0) {
+  std::vector<SchemaField> fields;
+  fields.emplace_back(SchemaField::MakeRequired(1, "id", 
std::make_shared<IntType>()));
+  return std::make_shared<Schema>(std::move(fields), schema_id);
+}
+
+// Helper function to count requirements of a specific type
+template <typename T>
+int CountRequirementsOfType(
+    const std::vector<std::unique_ptr<TableRequirement>>& requirements) {
+  int count = 0;

Review Comment:
   nit: use ranges



##########
src/iceberg/test/table_requirements_test.cc:
##########
@@ -47,16 +48,47 @@ std::unique_ptr<TableMetadata> CreateBaseMetadata(
   metadata->last_sequence_number = 0;
   metadata->last_updated_ms = TimePointMs{std::chrono::milliseconds(1000)};
   metadata->last_column_id = 0;
+  metadata->current_schema_id = Schema::kInitialSchemaId;
   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->default_sort_order_id = SortOrder::kUnsortedOrderId;
   metadata->next_row_id = TableMetadata::kInitialRowId;
   return metadata;
 }
 
+// Helper function to create a simple schema for tests
+std::shared_ptr<Schema> CreateTestSchema(int32_t schema_id = 0) {
+  std::vector<SchemaField> fields;
+  fields.emplace_back(SchemaField::MakeRequired(1, "id", 
std::make_shared<IntType>()));

Review Comment:
   ```suggestion
     fields.emplace_back(SchemaField::MakeRequired(1, "id", int32()));
   ```



-- 
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