private static Iterable<Partition> partitions(Table table, StaticTableScan scan) {
    Types.StructType partitionType = Partitioning.partitionType(table);

    StructLikeMap<Partition> partitions =
        StructLikeMap.create(partitionType, new PartitionComparator(partitionType));

    try (CloseableIterable<ManifestEntry<? extends ContentFile<?>>> entries = planEntries(scan)) {
      for (ManifestEntry<? extends ContentFile<?>> entry : entries) {
        Snapshot snapshot = table.snapshot(entry.snapshotId());
        ContentFile<?> file = entry.file();
        StructLike key =
            PartitionUtil.coercePartition(
                partitionType, table.specs().get(file.specId()), file.partition());
        partitions
            .computeIfAbsent(key, () -> new Partition(key, partitionType))
            .update(file, snapshot);
      }
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }

    return partitions.values();
  }
A {@link Table} implementation that exposes a table's partitions as rows.
iceberg/patched-iceberg-core/src/main/java/org/apache/iceberg/PartitionsTable.java