@Test
  public void testUdfSmallInt() throws Throwable {
    String scriptText =
        "DROP TABLE IF EXISTS result;\n" +
            "CREATE TABLE result (col_s smallint);\n" +
            "INSERT INTO result VALUES(123);\n" +
            "INSERT INTO result VALUES(321);\n" +
            "CREATE FUNCTION dbl(s smallint)\n" +
            "   RETURNS smallint\n" +
            "BEGIN\n" +
            "   RETURN s + s;\n" +
            "END;\n" +
            "SELECT dbl(col_s) FROM result;\n";
    testScriptFile(scriptText, args(), "246.*642");
  }
Start up a local Hive Server 2 for these tests
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestHplSqlViaBeeLine.java