@Test
  public void testUdfVarchar() throws Throwable {
    String scriptText =
        "DROP TABLE IF EXISTS result;\n" +
            "CREATE TABLE result (col_v varchar(20));\n" +
            "INSERT INTO result VALUES('Smith');\n" +
            "INSERT INTO result VALUES('Sachin');\n" +
            "CREATE FUNCTION hello(v varchar(20))\n" +
            "   RETURNS varchar(20)\n" +
            "BEGIN\n" +
            "   RETURN 'Hello ' || v || '!';\n" +
            "END;\n" +
            "SELECT hello(col_v) FROM result ORDER BY col_v ASC;\n";
    testScriptFile(scriptText, args(), "Hello Sachin!.*Hello Smith!");
  }
Start up a local Hive Server 2 for these tests
itests/hive-unit/src/test/java/org/apache/hive/beeline/TestHplSqlViaBeeLine.java