public static Collection<PartitionStats> computeStats(Table table, Snapshot snapshot) {
    Preconditions.checkArgument(table != null, "table cannot be null");
    Preconditions.checkArgument(Partitioning.isPartitioned(table), "table must be partitioned");
    Preconditions.checkArgument(snapshot != null, "snapshot cannot be null");

    StructType partitionType = Partitioning.partitionType(table);
    List<ManifestFile> manifests = snapshot.allManifests(table.io());
    Queue<PartitionMap<PartitionStats>> statsByManifest = Queues.newConcurrentLinkedQueue();
    Tasks.foreach(manifests)
        .stopOnFailure()
        .throwFailureWhenFinished()
        .executeWith(ThreadPools.getWorkerPool())
        .run(manifest -> statsByManifest.add(collectStats(table, manifest, partitionType)));

    return mergeStats(statsByManifest, table.specs());
  }
Computes the partition stats for the given snapshot of the table.

@param table the table for which partition stats to be computed.
@param snapshot the snapshot for which partition stats is computed.
@return the collection of {@link PartitionStats}
iceberg/patched-iceberg-core/src/main/java/org/apache/iceberg/PartitionStatsUtil.java