public static StructType groupingKeyType(Schema schema, Collection<PartitionSpec> specs) {
    return buildPartitionProjectionType("grouping key", specs, commonActiveFieldIds(schema, specs));
  }
Builds a grouping key type considering the provided schema and specs.

<p>A grouping key defines how data is split between files and consists of partition fields with
non-void transforms that are present in each provided spec. Iceberg guarantees that records
with different values for the grouping key are disjoint and are stored in separate files.

<p>If there is only one spec, the grouping key will include all partition fields with non-void
transforms from that spec. Whenever there are multiple specs, the grouping key will represent
an intersection of all partition fields with non-void transforms. If a partition field is
present only in a subset of specs, Iceberg cannot guarantee data distribution on that field.
That's why it will not be part of the grouping key. Unpartitioned tables or tables with
non-overlapping specs have empty grouping keys.

<p>When partition fields are dropped in v1 tables, they are replaced with new partition fields
that have the same field ID but use a void transform under the hood. Such fields cannot be part
of the grouping key as void transforms always return null.

<p>If the provided schema is not null, this method will only take into account partition fields
on top of columns present in the schema. Otherwise, all partition fields will be considered.

@param schema a schema specifying a set of source columns to consider (null to consider all)
@param specs one or many specs
@return the constructed grouping key type
iceberg/patched-iceberg-core/src/main/java/org/apache/iceberg/Partitioning.java