szehon-ho commented on code in PR #7190: URL: https://github.com/apache/iceberg/pull/7190#discussion_r1160326861
########## core/src/main/java/org/apache/iceberg/PartitionsTable.java: ########## @@ -96,27 +94,63 @@ private static StaticDataTask.Row convertPartition(Partition partition) { } private static Iterable<Partition> partitions(Table table, StaticTableScan scan) { - CloseableIterable<FileScanTask> tasks = planFiles(scan); Types.StructType normalizedPartitionType = Partitioning.partitionType(table); PartitionMap partitions = new PartitionMap(); // cache a position map needed by each partition spec to normalize partitions to final schema Map<Integer, int[]> normalizedPositionsBySpec = Maps.newHashMapWithExpectedSize(table.specs().size()); - for (FileScanTask task : tasks) { - PartitionData original = (PartitionData) task.file().partition(); - int[] normalizedPositions = - normalizedPositionsBySpec.computeIfAbsent( - task.spec().specId(), - specId -> normalizedPositions(table, specId, normalizedPartitionType)); + int[] normalizedPositions = + normalizedPositionsBySpec.computeIfAbsent( + table.spec().specId(), + specId -> normalizedPositions(table, specId, normalizedPartitionType)); + + CloseableIterable<DataFile> datafiles = planDataFiles(scan); + + for (DataFile dataFile : datafiles) { + PartitionData original = (PartitionData) dataFile.partition(); PartitionData normalized = normalizePartition(original, normalizedPartitionType, normalizedPositions); - partitions.get(normalized).update(task.file()); + partitions.get(normalized).update(dataFile); } + return partitions.all(); } + @VisibleForTesting + static CloseableIterable<DataFile> planDataFiles(StaticTableScan scan) { Review Comment: Yea I don't see an easy way in this pr , as there are going to be a few changes, let's do it in that pr right after this one then. -- 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