public static StructType groupingKeyType(Schema schema, Collection<PartitionSpec> specs) {
    return buildPartitionProjectionType("grouping key", specs, commonActiveFieldIds(schema, specs));
  }
@Test
  public void testGroupingKeyTypeWithProjectedSchema() {
    TestTables.TestTable table =
        TestTables.create(tableDir, "test", SCHEMA, BY_CATEGORY_DATA_SPEC, V1_FORMAT_VERSION);

    Schema projectedSchema = table.schema().select("id", "data");

    StructType expectedType =
        StructType.of(NestedField.optional(1001, "data", Types.StringType.get()));
    StructType actualType = Partitioning.groupingKeyType(projectedSchema, table.specs().values());
    assertThat(actualType).isEqualTo(expectedType);
  }