You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Alex Parvulescu <al...@gmail.com> on 2010/04/01 10:41:54 UTC

Re: Pig script variable in FOREACH

It works!

thanks Dmitriy

alex



On Wed, Mar 31, 2010 at 8:26 PM, Dmitriy Ryaboy <dv...@gmail.com> wrote:

> you probably want to enclose the constant in quotes. So,
> varOut = FOREACH varIn GENERATE $0, '$LOCALE';
>
> -D
>
> On Wed, Mar 31, 2010 at 7:56 AM, Alex Parvulescu
> <al...@gmail.com>wrote:
>
> > Hello,
> >
> > I'm trying to use a Pig variable in a foreach and I can't.
> >
> > I'm passing a var to the pig script. Let's call it $LOCALE
> >
> > and in my script I want to:
> >  ' varOut = FOREACH varIn GENERATE $0, $LOCALE; '
> >
> > This does not work:
> > [main] ERROR org.apache.pig.tools.grunt.Grunt - ERROR 1000: Error during
> > parsing. Invalid alias: fr in ....
> >
> > Obviusly 'fr' is the value of the $LOCALE variable, but I'd like to use
> > that
> > as a constant passed via script params
> >
> > thanks,
> > alex
> >
>