MCPcopy Create free account
hub / github.com/apache/pig / registerUDF

Method registerUDF

src/org/apache/pig/scripting/Pig.java:121–131  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

registerUDFMethod · 0.95

Calls 7

getScriptContextMethod · 0.95
getScriptEngineMethod · 0.95
registerFunctionsMethod · 0.95
getPigContextMethod · 0.95
infoMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected