Register scripting UDFs for use in Pig. Once this is done all UDFs defined in the file will be available for all subsequent Pig pipelines in this script. If you wish to register UDFS for only a single Pig pipeline, use register within that definition. @param udffile Path of the script UDF fil
(String udffile, String namespace)
| 119 | * @throws IOException |
| 120 | */ |
| 121 | public static void registerUDF(String udffile, String namespace) |
| 122 | throws IOException { |
| 123 | LOG.info("Register script UDF file: "+ udffile); |
| 124 | ScriptPigContext ctx = getScriptContext(); |
| 125 | ScriptEngine engine = ctx.getScriptEngine(); |
| 126 | // script file contains only functions, no need to separate |
| 127 | // functions from control flow code |
| 128 | if (namespace != null && namespace.isEmpty()) namespace = null; |
| 129 | engine.registerFunctions(udffile, namespace, ctx.getPigContext()); |
| 130 | addRegisterScriptUDFClause(udffile, namespace); |
| 131 | } |
| 132 | |
| 133 | /** |
| 134 | * Define an alias for a UDF or a streaming command. This definition |
no test coverage detected