You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by "Kochis, Allan" <Al...@schwab.com> on 2010/07/27 15:18:17 UTC
accessing pig params inside a UDF
I call a pig script
pig -param DATE=$date ~/bin/script.pig
inside of the pig script I filter records thru a perl udf
DEFINE parser `parser.pl` SHIP ( 'parser.pl' );
------------------------------------------------------
raw_records = LOAD '/logs/$DATE';
parsed_recs = STREAM raw_records THROUGH parser;
A simple question "How do I access the date parameter inside of the perl
script?"
Thanks
Allan.
Re: accessing pig params inside a UDF
Posted by Dmitriy Ryaboy <dv...@gmail.com>.
DEFINE parser `parser.pl $DATE` SHIP ('parser.pl');
Meaning -- you can pass the args on the command line you bind to the keyword
"parser", and have your perl script read said command-line args.
-D
On Tue, Jul 27, 2010 at 6:18 AM, Kochis, Allan <Al...@schwab.com>wrote:
> I call a pig script
>
> pig -param DATE=$date ~/bin/script.pig
>
> inside of the pig script I filter records thru a perl udf
>
>
> DEFINE parser `parser.pl` SHIP ( 'parser.pl' );
>
> ------------------------------------------------------
>
>
> raw_records = LOAD '/logs/$DATE';
> parsed_recs = STREAM raw_records THROUGH parser;
>
> A simple question "How do I access the date parameter inside of the perl
> script?"
>
> Thanks
>
> Allan.
>