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/03/31 16:56:30 UTC
Pig script variable in FOREACH
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
Re: Pig script variable in FOREACH
Posted by Alex Parvulescu <al...@gmail.com>.
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
> >
>
Re: Pig script variable in FOREACH
Posted by Dmitriy Ryaboy <dv...@gmail.com>.
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
>