@Deprecated
  public static void addPrimaryKey(
      TableSchema.Builder builder,
      MixedTable table,
      TableSchema tableSchema,
      String[] projectedColumns) {
    Set<String> projectedNames = Arrays.stream(projectedColumns).collect(Collectors.toSet());

    if (!table.isKeyedTable()) {
      return;
    }

    List<String> pks = table.asKeyedTable().primaryKeySpec().fieldNames();
    pks.forEach(
        pk -> {
          if (projectedNames.contains(pk)) {
            return;
          }
          builder.field(
              pk,
              tableSchema
                  .getFieldDataType(pk)
                  .orElseThrow(
                      () ->
                          new ValidationException(
                              "Mixed-format table primary key should be declared in table")));
        });
  }
Primary keys are the required fields to guarantee that readers can read keyed table in right
order, due to the automatic scaling in/out of nodes. The required fields should be added even
though projection push down
amoro-format-mixed/amoro-mixed-flink/amoro-mixed-flink-common/src/main/java/org/apache/amoro/flink/FlinkSchemaUtil.java