rdblue commented on code in PR #12847:
URL: https://github.com/apache/iceberg/pull/12847#discussion_r2067402548


##########
parquet/src/main/java/org/apache/iceberg/parquet/ParquetVariantUtil.java:
##########
@@ -395,7 +399,30 @@ public Type object(VariantObject object, List<String> 
names, List<Type> typedVal
 
     @Override
     public Type array(VariantArray array, List<Type> elementResults) {
-      return null;
+      if (elementResults.isEmpty()) {
+        return null;
+      }
+
+      // Choose most common type as shredding type and build 3-level list
+      Type defaultTYpe = elementResults.get(0);
+      Type shredType =
+          elementResults.stream()
+              .filter(Objects::nonNull)
+              .collect(Collectors.groupingBy(Function.identity(), 
Collectors.counting()))
+              .entrySet()
+              .stream()
+              .max(Map.Entry.comparingByValue())
+              .map(Map.Entry::getKey)
+              .orElse(defaultTYpe);

Review Comment:
   If the list is not empty, then this should never be used. Why default it?



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