class AlterTableService {

  public void alterTable(CloseableMetaStoreClient client, Table oldTable, Table newTable) throws Exception {
    List<FieldSchema> oldColumns = oldTable.getSd().getCols();
    List<FieldSchema> newColumns = newTable.getSd().getCols();
    if (hasAnyChangedColumns(oldColumns, newColumns)) {
      LOG
          .info("Found columns that have changed type, attempting to recreate target table with the new columns."
              + "Old columns: {}, new columns: {}", oldColumns, newColumns);
      Table tempTable = new Table(newTable);
      String tempName = newTable.getTableName() + "_temp";
      tempTable.setTableName(tempName);
      try {
        client.createTable(tempTable);
        copyPartitionsOperation.execute(client, newTable, tempTable);
        renameTableOperation.execute(client, tempTable, newTable);
      } finally {
        dropTableService.dropTable(client, tempTable.getDbName(), tempName);
      }
    } else {
      client.alter_table(newTable.getDbName(), newTable.getTableName(), newTable);
    }
  }

  public  AlterTableService(
      DropTableService dropTableService,
      CopyPartitionsOperation copyPartitionsOperation,
      RenameTableOperation renameTableOperation);

}