[
https://issues.apache.org/jira/browse/PIG-4920?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
liyunzhang_intel updated PIG-4920:
----------------------------------
Description:
udf.pig
{code}
register '/home/zly/prj/oss/merge.pig/pig/bin/udf.js' using javascript as
myfuncs;
A = load './passwd' as (a0:chararray, a1:chararray);
B = foreach A generate myfuncs.helloworld();
store B into './udf.out';
{code}
udf.js
{code}
helloworld.outputSchema = "word:chararray";
function helloworld() {
return 'Hello, World';
}
complex.outputSchema = "word:chararray";
function complex(word){
return {word:word};
}
{code}
run udf.pig in spark local mode(export SPARK_MASTER="local"), it successfully.
run udf.pig in spark yarn client mode(export SPARK_MASTER="yarn-client"), it
fails and error message like following:
{noformat}
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
at
org.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:744)
... 84 more
Caused by: java.lang.ExceptionInInitializerError
at
org.apache.pig.scripting.js.JsScriptEngine.getInstance(JsScriptEngine.java:87)
at org.apache.pig.scripting.js.JsFunction.<init>(JsFunction.java:173)
... 89 more
Caused by: java.lang.IllegalStateException: could not get script path from
UDFContext
at
org.apache.pig.scripting.js.JsScriptEngine$Holder.<clinit>(JsScriptEngine.java:69)
... 91 more
{noformat}
was:
udf.pig
{code}
register '/home/zly/prj/oss/merge.pig/pig/bin/udf.js' using javascript as
myfuncs;
A = load './passwd' as (a0:chararray, a1:chararray);
B = foreach A generate myfuncs.helloworld();
store B into './udf.out';
{code}
udf.js
{code}
helloworld.outputSchema = "word:chararray";
function helloworld() {
return 'Hello, World';
}
complex.outputSchema = "word:chararray";
function complex(word){
return {word:word};
}
{code}
run udf.pig in spark local mode(export SPARK_MASTER="local"), it successfully.
run udf.pig in spark yarn client mode(export SPARK_MASTER="yarn-client"), it
fails and error message like following:
{noformat}
[task-result-getter-0] 2016-06-02 15:13:13,647 WARN scheduler.TaskSetManager
(Logging.scala:logWarning(70)) - Lost task 0.0 in stage 0.0 (TID 0,
zly1.sh.intel.com): java.lang.RuntimeException: could not instantiate
'org.apache.pig.scripting.js.JsFunction' with arguments '[helloworld]'
at
org.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:776)
at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POUserFunc.instantiateFunc(POUserFunc.java:128)
at
org.apache.pig.backend.hadoop.executionengine.physicalLayer.expressionOperators.POUserFunc.readObject(POUserFunc.java:585)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at
java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1017)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1896)
at
java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1801)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1351)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:371)
at java.util.HashMap.readObject(HashMap.java:1396)
{noformat}
> Fail to use Javascript UDF in spark yarn client mode
> ----------------------------------------------------
>
> Key: PIG-4920
> URL: https://issues.apache.org/jira/browse/PIG-4920
> Project: Pig
> Issue Type: Sub-task
> Components: spark
> Reporter: liyunzhang_intel
> Fix For: spark-branch
>
>
> udf.pig
> {code}
> register '/home/zly/prj/oss/merge.pig/pig/bin/udf.js' using javascript as
> myfuncs;
> A = load './passwd' as (a0:chararray, a1:chararray);
> B = foreach A generate myfuncs.helloworld();
> store B into './udf.out';
> {code}
> udf.js
> {code}
> helloworld.outputSchema = "word:chararray";
> function helloworld() {
> return 'Hello, World';
> }
>
> complex.outputSchema = "word:chararray";
> function complex(word){
> return {word:word};
> }
> {code}
> run udf.pig in spark local mode(export SPARK_MASTER="local"), it successfully.
> run udf.pig in spark yarn client mode(export SPARK_MASTER="yarn-client"), it
> fails and error message like following:
> {noformat}
> Caused by: java.lang.reflect.InvocationTargetException
> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
> at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
> at java.lang.reflect.Constructor.newInstance(Constructor.java:408)
> at
> org.apache.pig.impl.PigContext.instantiateFuncFromSpec(PigContext.java:744)
> ... 84 more
> Caused by: java.lang.ExceptionInInitializerError
> at
> org.apache.pig.scripting.js.JsScriptEngine.getInstance(JsScriptEngine.java:87)
> at org.apache.pig.scripting.js.JsFunction.<init>(JsFunction.java:173)
> ... 89 more
> Caused by: java.lang.IllegalStateException: could not get script path from
> UDFContext
> at
> org.apache.pig.scripting.js.JsScriptEngine$Holder.<clinit>(JsScriptEngine.java:69)
> ... 91 more
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)