@Test
  public void testTableSelect() throws Throwable {
    String scriptText =
            "DROP TABLE IF EXISTS result;\n" +
            "CREATE TABLE result (s string);\n" +
            "DROP TABLE IF EXISTS emp;\n" +
            "CREATE TABLE emp (name string, age int);\n" +
            "INSERT INTO emp VALUES('alice', 20);\n" +
            "TYPE t_emp IS TABLE OF emp%ROWTYPE INDEX BY BINARY_INTEGER;\n" +
            "TYPE t_names IS TABLE OF emp.name%TYPE INDEX BY BINARY_INTEGER;\n" +
            "TYPE t_ages IS TABLE OF emp.age%TYPE INDEX BY BINARY_INTEGER;\n" +
            "DECLARE rows t_emp;\n" +
            "DECLARE names t_names;\n" +
            "DECLARE ages t_ages;\n" +
            "SELECT * INTO rows(200) FROM emp WHERE name = 'alice';\n" +
            "SELECT name, age INTO names(1), ages(1) FROM emp WHERE name = 'alice';\n" +
            "INSERT INTO result VALUES(rows(200).name || ' is ' || rows(200).age || ' ' || names(1) || ' = ' || ages(1));\n" +
            "SELECT * FROM result;\n";
    testScriptFile(scriptText, args(), " alice is 20 alice = 20");
  }
Start up a local Hive Server 2 for these tests
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestHplSqlViaBeeLine.java