pvary commented on code in PR #12528: URL: https://github.com/apache/iceberg/pull/12528#discussion_r2131959065
########## core/src/main/java/org/apache/iceberg/PartitionsTable.java: ########## @@ -238,26 +246,25 @@ private class PartitionsScan extends StaticTableScan { } } - static class PartitionMap { - private final StructLikeMap<Partition> partitions; - private final Types.StructType keyType; + private static class PartitionComparator implements Comparator<StructLike> { + private Comparator<StructLike> comparator; - PartitionMap(Types.StructType type) { - this.partitions = StructLikeMap.create(type); - this.keyType = type; + private PartitionComparator(Types.StructType struct) { + this.comparator = Comparators.forType(struct); } - Partition get(StructLike key) { - Partition partition = partitions.get(key); - if (partition == null) { - partition = new Partition(key, keyType); - partitions.put(key, partition); + @Override + public int compare(StructLike o1, StructLike o2) { + if (o1 instanceof StructProjection && o2 instanceof StructProjection) { + int cmp = + Integer.compare( + ((StructProjection) o1).projectedFields(), + ((StructProjection) o2).projectedFields()); + if (cmp != 0) { + return cmp; + } } - return partition; - } - - Iterable<Partition> all() { - return partitions.values(); + return comparator.compare(o1, o2); Review Comment: nit: newline before this ########## core/src/main/java/org/apache/iceberg/PartitionsTable.java: ########## @@ -290,27 +297,25 @@ void update(ContentFile<?> file, Snapshot snapshot) { if (snapshot != null) { long snapshotCommitTime = snapshot.timestampMillis() * 1000; if (this.lastUpdatedAt == null || snapshotCommitTime > this.lastUpdatedAt) { + this.specId = file.specId(); + Review Comment: Thx -- 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