Hi Alan,
You can use "define" to supply an argument to a UDF constructor.

You can see an example here:
http://ofps.oreilly.com/titles/9781449302641/intro_pig_latin.html#udf_define

I did just find to my surprise that this isn't in our documentation..
we should add that.

D

On Fri, Apr 6, 2012 at 1:38 PM, Walker, Alan <[email protected]> wrote:
> Hi,
>
> I'm having some challenges with a  load function.  It only seems to work with 
> a void constructor.  The Java code has a void constructor and a String 
> constructor, much like the SimpleTextLoader example.  Any thoughts on what 
> might be going wrong?
>
>    public ShoppingReader() {
>        parms = "";
>    }
>
>    public ShoppingReader(String tmp) {
>        parms = tmp;
>    }
>
> grunt> A = LOAD '/user/alanw/*.xml' USING 
> com.sabre.pigshop.ShoppingReader('all') AS (x);
> 2012-04-06 16:04:08,593 [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 
> 2999: Unexpected internal error. could not instantiate 
> com.sabre.pigshop.ShoppingReader' with arguments '[all]'
>
> Thanks,
> Alan.
>

Reply via email to