What version of Pig are you using? Can you make sure the package name/path
"myjar.PigClass" is correct.

On Sun, Nov 27, 2011 at 11:56 PM, Anil Barfa <[email protected]> wrote:

> Hi
> I am using java UDF with pig. I want pass file name to UDF. I have done it
> as follows but it is not working.
>
> PIg script
>
> REGISTER myjar.jar;
> DEFINE myfun myjar.PigClass('/home/myfile.txt');
>
> --load input data
> InputValue =  LOAD '$input'  AS (val1,val2,val3);
>
> InputWithMeta = FOREACH InputValue GENERATE myfun(val1,val2,val3);
>
>
>  Java code PigClass.java
>
> class PigClass extends EvalFunc<Tuple>
> {
>  public PigClass(String strPath)
>  {
>  }
>  public Tuple exec(Tuple input ) throws IOException {
>  }
> };
>
> I am getting following Error.
>
> *<file MyScript.pig, line 7, column 45> Failed to generate logical plan.
> Nested exception: java.lang.RuntimeException: could not instantiate '
> myjar.PigClass**' with arguments '[/home/myfile.txt]'*
>
>
> Thanks and Regards
> Anil Barfa
>

Reply via email to