wombatu-kun commented on code in PR #16657:
URL: https://github.com/apache/iceberg/pull/16657#discussion_r3432408302


##########
kafka-connect/kafka-connect/src/main/java/org/apache/iceberg/connect/data/RecordConverter.java:
##########
@@ -300,28 +301,29 @@ protected List<Object> convertListValue(
       Object value, ListType type, SchemaUpdate.Consumer schemaUpdateConsumer) 
{
     Preconditions.checkArgument(value instanceof List);
     List<?> list = (List<?>) value;
-    return list.stream()
-        .map(
-            element -> {
-              int fieldId = type.fields().get(0).fieldId();
-              return convertValue(element, type.elementType(), fieldId, 
schemaUpdateConsumer);
-            })
-        .collect(Collectors.toList());
+    int elementFieldId = type.fields().get(0).fieldId();
+    Type elementType = type.elementType();
+    List<Object> result = Lists.newArrayListWithCapacity(list.size());
+    for (Object element : list) {
+      result.add(convertValue(element, elementType, elementFieldId, 
schemaUpdateConsumer));
+    }
+    return result;
   }
 
   protected Map<Object, Object> convertMapValue(
       Object value, MapType type, SchemaUpdate.Consumer schemaUpdateConsumer) {
     Preconditions.checkArgument(value instanceof Map);
     Map<?, ?> map = (Map<?, ?>) value;

Review Comment:
   The empty-map test added in c0c339023 runs this method with size 0, so the 
now-eager get(1) is exercised on the empty path you flagged.



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