pvary commented on code in PR #15747:
URL: https://github.com/apache/iceberg/pull/15747#discussion_r2981381548


##########
flink/v1.20/flink/src/main/java/org/apache/iceberg/flink/data/FlinkParquetReaders.java:
##########
@@ -152,8 +152,13 @@ public ParquetValueReader<?> list(
       Type elementType = ParquetSchemaUtil.determineListElementType(array);
       int elementD = type.getMaxDefinitionLevel(path(elementType.getName())) - 
1;
 
-      return new ArrayReader<>(
-          repeatedD, repeatedR, ParquetValueReaders.option(elementType, 
elementD, elementReader));
+      if (ParquetSchemaUtil.isOldListElementType(array)) {

Review Comment:
   What about having this duplicated code in a single place, like:
   ```
     public static <E> ResolvedList<E> resolveList(
         MessageType fileType,
         GroupType array,
         String[] repeatedPath,
         String[] elementPath,
         ParquetValueReader<E> elementReader) {
       Type elementType = ParquetSchemaUtil.determineListElementType(array);
       int elementD = fileType.getMaxDefinitionLevel(elementPath) - 1;
   
       if (ParquetSchemaUtil.isOldListElementType(array)) {
         int elementR = fileType.getMaxRepetitionLevel(elementPath) - 1;
         return new ResolvedList<>(elementD, elementR, elementReader);
       } else {
         int repeatedD = fileType.getMaxDefinitionLevel(repeatedPath) - 1;
         int repeatedR = fileType.getMaxRepetitionLevel(repeatedPath) - 1;
         return new ResolvedList<>(
             repeatedD, repeatedR, option(elementType, elementD, 
elementReader));
       }
     }
   ```



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