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

Method JsFunction

src/org/apache/pig/scripting/js/JsFunction.java:172–191  ·  view source on GitHub ↗
(String functionName)

Source from the content-addressed store, hash-verified

170 //////////////////////
171
172 public JsFunction(String functionName) {
173 this.jsScriptEngine = JsScriptEngine.getInstance();
174 this.functionName = functionName;
175 Object outputSchemaObj = jsScriptEngine.jsEval(this.getClass().getName() + "(String)",
176 functionName + ".outputSchema");
177 //if no schema defined, fall back to bytearray
178 if (outputSchemaObj == null || outputSchemaObj instanceof Undefined) {
179 this.outputSchema = new Schema(new Schema.FieldSchema(null, DataType.BYTEARRAY));
180 }
181 else {
182 try {
183 this.outputSchema = Utils.getSchemaFromString(outputSchemaObj.toString());
184 }
185 catch (ParserException e) {
186 throw new IllegalArgumentException(functionName
187 + ".outputSchema is not a valid schema: " + e.getMessage(), e);
188 }
189 }
190
191 }
192
193 ///////////////////////////
194 // EvalFunc implementation

Callers

nothing calls this directly

Calls 7

getInstanceMethod · 0.95
getSchemaFromStringMethod · 0.95
jsEvalMethod · 0.80
getClassMethod · 0.80
getNameMethod · 0.45
toStringMethod · 0.45
getMessageMethod · 0.45

Tested by

no test coverage detected