@Test
  public void testDisallowColChangesExceptionList() {
    assertTrue("Test setup failed. MiniHS2 is not initialized",
        miniHS2 != null && miniHS2.isStarted());

    try (
        Connection hs2conn = DriverManager
            .getConnection(TestDisallowColChangesExceptionList.miniHS2.getJdbcURL(), "hive",
                "hive");
        Statement stmt = hs2conn.createStatement();
    ) {
      // parquet and orc are allowed to make incompat changes based on the
      // hiveConf
      // change c2 from int to smallint
      stmt.execute("alter table testParquet change column c2 c2 smallint");
      // drop c1
      stmt.execute("alter table testParquet replace columns (c2 int)");
      // change c1 to smallint; orc doesn't support drop columns and query fails
      // during compilation itself
      stmt.execute("alter table testOrc change column c2 c2 smallint");
      // make sure text tables don't allow incompat column changes because
      // they are not in the exception list
      try {
        // change text table column c1 from int to small; this should fail because it is
        // not in the exception list
        stmt.execute("alter table testText change column c2 c2 smallint");
        fail("Exception not thrown");
      } catch (Exception e1) {
        assertTrue("Unexpected exception: " + e1.getMessage(), e1.getMessage().contains(
            "Unable to alter table. The following columns have types incompatible with the existing columns in their respective positions"));
      }
      try {
        // drop c1 column; this should not be allowed since text is not in the exception
        // list
        stmt.execute("alter table testText replace columns (c2 int)");
        fail("Exception not thrown");
      } catch (Exception e1) {
        assertTrue("Unexpected exception: " + e1.getMessage(), e1.getMessage().contains(
            "Unable to alter table. The following columns have types incompatible with the existing columns in their respective positions"));
      }
    } catch (Exception e2) {
      fail("Unexpected Exception: " + e2.getMessage());
    }
  }
Test which makes sure that incompatible column changes are allowed if the serde of the
table is defined in the configuration metastore.allow.incompatible.col.type.changes.serdes
itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestDisallowColChangesExceptionList.java