@Test
  public void testTableRowAssignment() 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', 16);\n" +
            "INSERT INTO emp VALUES('bob', 18);\n" +
            "TYPE tbl_type IS TABLE OF emp%ROWTYPE INDEX BY BINARY_INTEGER;\n" +
            "DECLARE tbl tbl_type;\n" +
            "DECLARE tmp tbl_type;\n" +
            "SELECT * INTO tbl(1) FROM emp WHERE name = 'alice';\n" +
            "SELECT * INTO tmp(1) FROM emp WHERE name = 'bob';\n" +
            "tbl(2) := tmp(1);" +
            "INSERT INTO result VALUES( tbl(1).name || ' ' || tbl(1).age || ' ' || tbl(2).name || ' ' || tbl(2).age );\n" +
            "SELECT * FROM result;\n";
    testScriptFile(scriptText, args(), "alice 16 bob 18");
  }
Start up a local Hive Server 2 for these tests
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestHplSqlViaBeeLine.java