public void registerUdf() {
    if (udfRegistered) {
      return;
    }
    ArrayList<String> sql = new ArrayList<>();
    String dir = Utils.getExecDir();
    addJar(sql, dir, "hive-hplsql");
    addJar(sql, dir, "antlr4-runtime");
    if(!conf.getLocation().equals("")) {
      sql.add("ADD FILE " + conf.getLocation());
    } else {
      sql.add("ADD FILE " + dir + Conf.SITE_XML);
    }
    if (dotHplsqlrcExists) {
      sql.add("ADD FILE " + dir + Conf.DOT_HPLSQLRC);
    }
    if (hplsqlrcExists) {
      sql.add("ADD FILE " + dir + Conf.HPLSQLRC);
    }
    String lu = createLocalUdf();
    if (lu != null) {
      sql.add("ADD FILE " + lu);
    }
    sql.add("CREATE TEMPORARY FUNCTION hplsql AS 'org.apache.hive.hplsql.udf.Udf'");
    exec.conn.addPreSql(exec.conf.defaultConnection, sql);
    udfRegistered = true;
  }
Register JARs, FILEs and CREATE TEMPORARY FUNCTION for UDF call
hplsql/src/main/java/org/apache/hive/hplsql/Exec.java