@Test
  public void testExecuteImmediateSelectCountStatement() throws Throwable {
    String scriptText =
        "DROP TABLE IF EXISTS result;\n" +
            "CREATE TABLE result (s string);\n" +
            "execute immediate 'SELECT count(*) from result';";
    // Inverted match, output should not have NPE
    testScriptFile(scriptText, args(), "^(.(?!(ClassCastException)))*$", OutStream.ERR);
  }
Start up a local Hive Server 2 for these tests
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestHplSqlViaBeeLine.java