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


##########
src/iceberg/test/partition_spec_test.cc:
##########
@@ -303,4 +303,126 @@ TEST(PartitionSpecTest, PartitionFieldInStructInMap) {
   EXPECT_THAT(result_value, HasErrorMessage("Invalid partition field parent"));
 }
 
+TEST(PartitionSpecTest, ValidateRedundantPartitionsExactDuplicates) {
+  // Create a schema with different field types
+  auto ts_field = SchemaField::MakeRequired(1, "ts", timestamp());
+  auto id_field = SchemaField::MakeRequired(2, "id", int64());
+  Schema schema({ts_field, id_field}, Schema::kInitialSchemaId);
+
+  // Test: exact duplicate transforms on same field (same dedup name)
+  {
+    PartitionField field1(1, 1000, "ts_day1", Transform::Day());

Review Comment:
   nit: it would be good to use the actual partition name to make it less 
misleading. The name should follow `sourceName_transform_sourceId`



##########
src/iceberg/partition_spec.cc:
##########
@@ -184,11 +187,10 @@ Status PartitionSpec::ValidatePartitionName(const Schema& 
schema,
   std::unordered_set<std::string> partition_names;
   for (const auto& partition_field : spec.fields()) {
     auto name = std::string(partition_field.name());
-    ICEBERG_PRECHECK(!name.empty(), "Cannot use empty partition name: {}", 
name);
+    ICEBERG_CHECK(!name.empty(), "Cannot use empty partition name: {}", name);
 
-    if (partition_names.contains(name)) {
-      return InvalidArgument("Cannot use partition name more than once: {}", 
name);
-    }
+    ICEBERG_PRECHECK(!partition_names.contains(name),

Review Comment:
   Is `ICEBERG_CHECK` more appropriate?



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