jbonofre commented on code in PR #12897:
URL: https://github.com/apache/iceberg/pull/12897#discussion_r2060214278


##########
api/src/main/java/org/apache/iceberg/PartitionSpec.java:
##########
@@ -601,17 +601,26 @@ public Builder alwaysNull(String sourceName) {
 
     // add a partition field with an auto-increment partition field id 
starting from
     // PARTITION_DATA_ID_START
+    Builder add(List<Integer> sourceIds, String name, Transform<?, ?> 
transform) {
+      return add(sourceIds, nextFieldId(), name, transform);
+    }
+
     Builder add(int sourceId, String name, Transform<?, ?> transform) {
-      return add(sourceId, nextFieldId(), name, transform);
+      return add(List.of(sourceId), name, transform);
     }
 
-    Builder add(int sourceId, int fieldId, String name, Transform<?, ?> 
transform) {
-      checkAndAddPartitionName(name, sourceId);
-      fields.add(new PartitionField(sourceId, fieldId, name, transform));
+    Builder add(List<Integer> sourceIds, int fieldId, String name, 
Transform<?, ?> transform) {
+      // we use the first entry in the source-ids list here
+      checkAndAddPartitionName(name, sourceIds.get(0));

Review Comment:
   The sourceId here is to resolve conflict (no impact on name):
   
   ```
           if (sourceColumnId != null) {
             // for identity transform case we allow conflicts between 
partition and schema field name
             // as
             //   long as they are sourced from the same schema field
             Preconditions.checkArgument(
                 schemaField == null || schemaField.fieldId() == sourceColumnId,
                 "Cannot create identity partition sourced from different field 
in schema: %s",
                 name);
   ```
   
   Let me check if we should compare `fieldId` with each `column id`.



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to