public static void upgradeHiveTable(
      MixedHiveCatalog mixedHiveCatalog,
      TableIdentifier tableIdentifier,
      List<String> pkList,
      Map<String, String> properties)
      throws Exception {
    if (!formatCheck(mixedHiveCatalog.getHMSClient(), tableIdentifier, properties)) {
      throw new IllegalArgumentException("The storage format is not support");
    }
    boolean upgradeHive = false;
    try {
      Table hiveTable =
          HiveTableUtil.loadHmsTable(mixedHiveCatalog.getHMSClient(), tableIdentifier);

      Schema schema = HiveSchemaUtil.convertHiveSchemaToIcebergSchema(hiveTable, pkList);

      List<FieldSchema> partitionKeys = hiveTable.getPartitionKeys();

      PartitionSpec.Builder partitionBuilder = PartitionSpec.builderFor(schema);
      partitionKeys.stream().forEach(p -> partitionBuilder.identity(p.getName()));

      PrimaryKeySpec.Builder primaryKeyBuilder = PrimaryKeySpec.builderFor(schema);
      pkList.stream().forEach(p -> primaryKeyBuilder.addColumn(p));

      MixedTable mixedTable =
          mixedHiveCatalog
              .newTableBuilder(tableIdentifier, schema)
              .withProperties(properties)
              .withPartitionSpec(partitionBuilder.build())
              .withPrimaryKeySpec(primaryKeyBuilder.build())
              .withProperty(HiveTableProperties.ALLOW_HIVE_TABLE_EXISTED, "true")
              .create();
      upgradeHive = true;
      UpgradeHiveTableUtil.hiveDataMigration(
          (SupportHive) mixedTable, mixedHiveCatalog, tableIdentifier);
    } catch (Throwable t) {
      if (upgradeHive) {
        mixedHiveCatalog.dropTable(tableIdentifier, false);
      }
      throw t;
    }
  }
Upgrade a hive table to an mixed-hive table.

@param mixedHiveCatalog A mixed-hive catalog
@param tableIdentifier A table identifier
@param pkList The name of the columns that needs to be set as the primary key
@param properties Properties to be added to the target table
amoro-format-mixed/amoro-mixed-hive/src/main/java/org/apache/amoro/hive/utils/UpgradeHiveTableUtil.java