public static StructType partitionType(Table table) {
    Collection<PartitionSpec> specs = table.specs().values();
    return buildPartitionProjectionType("table partition", specs, allFieldIds(specs));
  }
@Test
  public void testPartitionTypeWithIncompatibleSpecEvolution() {
    TestTables.TestTable table =
        TestTables.create(tableDir, "test", SCHEMA, BY_DATA_SPEC, V1_FORMAT_VERSION);

    PartitionSpec newSpec = PartitionSpec.builderFor(table.schema()).identity("category").build();

    TableOperations ops = ((HasTableOperations) table).operations();
    TableMetadata current = ops.current();
    ops.commit(current, current.updatePartitionSpec(newSpec));

    assertThat(table.specs()).hasSize(2);

    assertThatThrownBy(() -> Partitioning.partitionType(table))
        .isInstanceOf(ValidationException.class)
        .hasMessageStartingWith("Conflicting partition fields");
  }