aihuaxu commented on code in PR #12933: URL: https://github.com/apache/iceberg/pull/12933#discussion_r2069710743
########## 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: I don't think we will have the case that all the elements will be stored in `value` since I would expect engines will at least choose a shredding type that matches some of the elements. I think this is more common: by sampling the elements, we choose INT32 as the shredding type while some are strings. If all of theme are in `value` and they are binary, that doesn't seem to be useful. -- 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