@Test
  public void testMetaDataGetExternalTables() throws SQLException {
    Statement stmt = con.createStatement();
    stmt.execute("set " + HiveConf.ConfVars.HIVE_SERVER2_TABLE_TYPE_MAPPING.varname + " = "
        + TableTypeMappings.HIVE.toString());
    stmt.close();
    ResultSet rs =
        con.getMetaData().getTables(testDbName, null, null,
            new String[] { TableType.EXTERNAL_TABLE.toString() });
    ResultSetMetaData resMeta = rs.getMetaData();
    assertEquals(10, resMeta.getColumnCount());
    assertEquals("TABLE_CAT", resMeta.getColumnName(1));
    assertEquals("TABLE_SCHEM", resMeta.getColumnName(2));
    assertEquals("TABLE_NAME", resMeta.getColumnName(3));
    assertEquals("TABLE_TYPE", resMeta.getColumnName(4));
    assertEquals("REMARKS", resMeta.getColumnName(5));

    rs.next();

    String resultDbName = rs.getString("TABLE_SCHEM");
    assertEquals(resultDbName, testDbName);
    String resultTableName = rs.getString("TABLE_NAME");
    assertEquals(resultTableName, externalTableName.toLowerCase());

    String resultTableComment = rs.getString("REMARKS");
    assertTrue("Missing comment on the table.", resultTableComment.length() > 0);
    String tableType = rs.getString("TABLE_TYPE");
    assertEquals(TableType.EXTERNAL_TABLE.toString(), tableType);

    assertFalse("Unexpected table", rs.next());
  }
Execute "set x" and extract value from key=val format result
Verify the extracted value
@param key
@param expectedVal
@throws Exception
itests/hive-unit/src/test/java/org/apache/hive/jdbc/TestJdbcDriver2.java