private void checkColTypeChangeCompatible(Configuration conf, Table oldTable,
      Table newTable) throws InvalidOperationException {
    List<FieldSchema> oldCols = oldTable.getSd().getCols();
    List<FieldSchema> newCols = newTable.getSd().getCols();
    List<String> incompatibleCols = new ArrayList<>();
    int maxCols = Math.min(oldCols.size(), newCols.size());
    for (int i = 0; i < maxCols; i++) {
      if (!ColumnType.areColTypesCompatible(
          ColumnType.getTypeName(oldCols.get(i).getType()),
          ColumnType.getTypeName(newCols.get(i).getType()))) {
        incompatibleCols.add(newCols.get(i).getName());
      }
    }
    if (!incompatibleCols.isEmpty()) {
      Collection<String> exceptedTableSerdes = MetastoreConf.getStringCollection(conf,
          MetastoreConf.ConfVars.ALLOW_INCOMPATIBLE_COL_TYPE_CHANGES_TABLE_SERDES);
      SerDeInfo serDeInfo = oldTable.getSd().getSerdeInfo();
      String serializationLib =
          serDeInfo == null ? null : serDeInfo.getSerializationLib();
      if (exceptedTableSerdes.contains(serializationLib)) {
        LOG.info(
            "Allowing incompatible column type change of {} for table {}"
                + " since the table serde {} is in excepted list of serdes",
            incompatibleCols, (oldTable.getDbName() + "." + oldTable.getTableName()),
            serializationLib);
        return;
      }
      throw new InvalidOperationException(
          "The following columns have types incompatible with the existing " +
              "columns in their respective positions :\n" +
              org.apache.commons.lang3.StringUtils.join(incompatibleCols, ',')
      );
    }
  }
Checks if the column type changes in the oldTable and newTable are allowed or not. In
addition to checking if the incompatible changes are allowed or not, this also checks
if the table serde library belongs to a list of table serdes which support making any
column type changes.

@param conf     The configuration which if incompatible col type changes are allowed
                or not.
@param oldTable The instance of the table being altered.
@param newTable The new instance of the table which represents the altered state of
                the table.
@throws InvalidOperationException
standalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/DefaultIncompatibleTableChangeHandler.java