public static Schema convertHiveSchemaToIcebergSchema(Table hiveTable, List<String> primaryKeys) {

    List<FieldSchema> hiveSchema = hiveTable.getSd().getCols();
    hiveSchema.addAll(hiveTable.getPartitionKeys());
    Set<String> pkSet = new HashSet<>(primaryKeys);
    Schema schema = org.apache.iceberg.hive.HiveSchemaUtil.convert(hiveSchema, true);
    if (primaryKeys.isEmpty()) {
      return schema;
    }
    List<Types.NestedField> columnsWithPk = new ArrayList<>();
    schema
        .columns()
        .forEach(
            nestedField -> {
              if (pkSet.contains(nestedField.name())) {
                columnsWithPk.add(nestedField.asRequired());
              } else {
                columnsWithPk.add(nestedField);
              }
            });
    return new Schema(columnsWithPk);
  }
Converts the Hive schema to a Iceberg schema with pk.

@param hiveTable The original Hive table to convert
@param primaryKeys The primary keys need to add to Iceberg schema
@return An Iceberg schema
amoro-format-mixed/amoro-mixed-hive/src/main/java/org/apache/amoro/hive/utils/HiveSchemaUtil.java