private static void hiveDataMigration(
      SupportHive mixedHiveTable,
      MixedHiveCatalog mixedHiveCatalog,
      TableIdentifier tableIdentifier)
      throws Exception {
    Table hiveTable = HiveTableUtil.loadHmsTable(mixedHiveCatalog.getHMSClient(), tableIdentifier);
    String hiveDataLocation = HiveTableUtil.hiveRootLocation(hiveTable.getSd().getLocation());
    AuthenticatedHadoopFileIO io = mixedHiveTable.io();
    io.makeDirectories(hiveDataLocation);
    String newPath;
    if (hiveTable.getPartitionKeys().isEmpty()) {
      newPath = hiveDataLocation + "/" + System.currentTimeMillis() + "_" + UUID.randomUUID();
      io.makeDirectories(newPath);
      io.listDirectory(hiveTable.getSd().getLocation())
          .forEach(
              p -> {
                if (!p.isDirectory()) {
                  io.asFileSystemIO().rename(p.location(), newPath);
                }
              });

      try {
        HiveTableUtil.alterTableLocation(
            mixedHiveCatalog.getHMSClient(), mixedHiveTable.id(), newPath);
        LOG.info("Table {} alter hive table location {}", mixedHiveTable.name(), hiveDataLocation);
      } catch (IOException e) {
        LOG.warn("Table {} alter hive table location failed", mixedHiveTable.name(), e);
        throw new RuntimeException(e);
      }
    } else {
      List<String> partitions =
          HivePartitionUtil.getHivePartitionNames(mixedHiveCatalog.getHMSClient(), tableIdentifier);
      List<String> partitionLocations =
          HivePartitionUtil.getHivePartitionLocations(
              mixedHiveCatalog.getHMSClient(), tableIdentifier);
      for (int i = 0; i < partitionLocations.size(); i++) {
        String partition = partitions.get(i);
        String oldLocation = partitionLocations.get(i);
        String newLocation =
            hiveDataLocation
                + "/"
                + partition
                + "/"
                + HiveTableUtil.newHiveSubdirectory(DEFAULT_TXID);
        io.makeDirectories(newLocation);

        io.listDirectory(oldLocation)
            .forEach(
                p -> {
                  if (!p.isDirectory()) {
                    io.asFileSystemIO().rename(p.location(), newLocation);
                  }
                });
        HivePartitionUtil.alterPartition(
            mixedHiveCatalog.getHMSClient(), tableIdentifier, partition, newLocation);
      }
    }
    HiveMetaSynchronizer.syncHiveDataToMixedTable(mixedHiveTable, mixedHiveCatalog.getHMSClient());
    hiveTable = HiveTableUtil.loadHmsTable(mixedHiveCatalog.getHMSClient(), tableIdentifier);
    fillPartitionProperties(mixedHiveTable, mixedHiveCatalog, hiveTable);
  }
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