rdblue commented on a change in pull request #2454:
URL: https://github.com/apache/iceberg/pull/2454#discussion_r615322994



##########
File path: 
api/src/main/java/org/apache/iceberg/transforms/PartitionSpecVisitor.java
##########
@@ -114,13 +115,10 @@ default T unknown(int fieldId, String sourceName, int 
sourceId, String transform
    */
   @Deprecated
   static <R> List<R> visit(Schema schema, PartitionSpec spec, 
PartitionSpecVisitor<R> visitor) {
-    List<R> results = Lists.newArrayListWithExpectedSize(spec.fields().size());
-
-    for (PartitionField field : spec.fields()) {
-      results.add(visit(schema, field, visitor));
-    }
-
-    return results;
+    return spec.fields().stream()
+        .map(field -> visit(schema, field, visitor))
+        .filter(Objects::nonNull)

Review comment:
       I don't think it is right to automatically discard nulls. Those might be 
part of the result produced by the visitor. And it is not possible to see which 
field produced the null value.




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

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