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


##########
api/src/main/java/org/apache/iceberg/PartitionField.java:
##########
@@ -58,7 +74,10 @@ public String name() {
 
   @Override
   public String toString() {
-    return fieldId + ": " + name + ": " + transform + "(" + sourceId + ")";
+    if (sourceIds.size() == 1) {
+      return fieldId + ": " + name + ": " + transform + "(" + sourceIds.get(0) 
+ ")";
+    }
+    return fieldId + ": " + name + ": " + transform + "(" + sourceIds + ")";

Review Comment:
   The multi-source-id branch uses `List.toString()` directly, which produces 
square brackets in the output: `transform([1, 2, 3])` instead of `transform(1, 
2, 3)`.
   
   Using a `Joiner` (as done elsewhere in the api module, e.g. 
`UnboundPredicate`, `BoundSetPredicate`) would fix this and also eliminate the 
need for the `size() == 1` special case:
   
   ```java
   private static final Joiner COMMA = Joiner.on(", ");
   
   @Override
   public String toString() {
     return fieldId + ": " + name + ": " + transform + "(" + 
COMMA.join(sourceIds) + ")";
   }
   ```
   
   Same applies to `SortField.toString()`.



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