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

    try (
        Connection hs2Conn1 = DriverManager
            .getConnection(TestHiveMetaStoreAlterColumnPar.miniHS2.getJdbcURL(), "hive", "hive");
        Statement stmt1 = hs2Conn1.createStatement();
        Connection hs2Conn2 = DriverManager
            .getConnection(TestHiveMetaStoreAlterColumnPar.miniHS2.getJdbcURL(), "hive", "hive");
        Statement stmt2 = hs2Conn2.createStatement();
    ) {
      // Set parameter to be false in connection 1.  int to smallint allowed
      stmt1.execute("set metaconf:hive.metastore.disallow.incompatible.col.type.changes=false");
      stmt1.execute("alter table t1 change column c1 c1 smallint");

      // Change the type back to int so that the same alter can be attempted from connection 2.
      stmt1.execute("alter table t1 change column c1 c1 int");

      // parameter value not changed to false in connection 2.  int to smallint throws exception
      try {
        stmt2.execute("alter table t1 change column c1 c1 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"));
      }

      // parameter value is still false in 1st connection.  The alter still goes through.
      stmt1.execute("alter table t1 change column c1 c1 smallint");
    } catch (Exception e2) {
      fail("Unexpected Exception: " + e2.getMessage());
    }
  }
Test that set/unset of metaconf:hive.metastore.disallow.incompatible.col.type.changes is local
to the session

Two connections are created.  In one connection
metaconf:hive.metastore.disallow.incompatible.col.type.changes is set to false.  Then the
columm type can changed from int to smallint.  In the other connection
metaconf:hive.metastore.disallow.incompatible.col.type.changes is left with the default value
true.  In that connection changing column type from int to smallint will throw an error.
itests/hive-unit/src/test/java/org/apache/hadoop/hive/metastore/TestHiveMetaStoreAlterColumnPar.java