Grokbase Groups Pig user October 2010
FAQ
I need to use the output of one alias in a future calculation:

Suppose I have:

C=(5)

and then later, I have

G=(1,A)
(3,B)
(5,C)

then I want to do a foreach on G where I multiply each G.$0 by C.$0, ending
up with

H=(5,A)
(15,B)
(25,C)

how can I do that?

I did accomplish it by doing a CROSS against the two tables and then running
foreach against that, but I want to avoid using CROSS.

Thanks for any ideas!
-M@

--
Have you thanked a teacher today? ---> http://www.liftateacher.org

Search Discussions

  • Aniket Mokashi at Oct 20, 2010 at 7:56 pm
    In pig 0.8, you can say,
    P = foreach G generate G.$0 * C.$0, G.$1;

    Other methods are discussed here-
    https://issues.apache.org/jira/browse/PIG-1434

    Thanks,
    Aniket
    On Wed, October 20, 2010 3:41 pm, Matt Tanquary wrote:
    I need to use the output of one alias in a future calculation:


    Suppose I have:


    C=(5)


    and then later, I have

    G=(1,A)
    (3,B)
    (5,C)


    then I want to do a foreach on G where I multiply each G.$0 by C.$0,
    ending up with

    H=(5,A)
    (15,B)
    (25,C)


    how can I do that?

    I did accomplish it by doing a CROSS against the two tables and then
    running foreach against that, but I want to avoid using CROSS.

    Thanks for any ideas!
    -M@


    --
    Have you thanked a teacher today? ---> http://www.liftateacher.org

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedOct 20, '10 at 7:41p
activeOct 20, '10 at 7:56p
posts2
users2
websitepig.apache.org

2 users in discussion

Matt Tanquary: 1 post Aniket Mokashi: 1 post

People

Translate

site design / logo © 2021 Grokbase