rdblue commented on code in PR #12933: URL: https://github.com/apache/iceberg/pull/12933#discussion_r2069226350
########## parquet/src/main/java/org/apache/iceberg/parquet/ParquetVariantUtil.java: ########## @@ -403,19 +400,14 @@ public Type array(VariantArray array, List<Type> elementResults) { 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); - - return list(shredType); + // Shred if all the elements are of a uniform type and build 3-level list + Type shredType = elementResults.get(0); + if (shredType != null + && elementResults.stream().allMatch(type -> Objects.equals(type, shredType))) { + return list(shredType); + } + + return null; Review Comment: Do you think there are cases where we want to shred an array of mixed types, with each value stored in `value` as an encoded variant? I'm not sure. -- 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