Grokbase Groups Pig user April 2013
FAQ
Hi,
I have data of format

id1,id2, value
1 , abc, 2993
1, dhu, 9284
1,dus,2389
2, acs,29392

and so on

For each id1, I want to find the maximum value and then divide value by
max_value
so in example above:

1,abc, 2993/9284
1,dhu ,9284/9284
1,dus, 2389/9284
2,acs, 29392/max_value_for_this id

How do i do this in pig?
Thanks

Search Discussions

  • Russell Jurney at Apr 27, 2013 at 9:41 am
    values = LOAD 'my_path' AS (id1:int, id2:chararray, value:int);
    overall = FOREACH (GROUP values BY id1) GENERATE group AS id1,
    value/MAX(value) as div_max;

    Russell Jurney http://datasyndrome.com
    On Apr 27, 2013, at 2:32 AM, jamal sasha wrote:

    Hi,
    I have data of format

    id1,id2, value
    1 , abc, 2993
    1, dhu, 9284
    1,dus,2389
    2, acs,29392

    and so on

    For each id1, I want to find the maximum value and then divide value by
    max_value
    so in example above:

    1,abc, 2993/9284
    1,dhu ,9284/9284
    1,dus, 2389/9284
    2,acs, 29392/max_value_for_this id

    How do i do this in pig?
    Thanks

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriespig, hadoop
postedApr 27, '13 at 9:32a
activeApr 27, '13 at 9:41a
posts2
users2
websitepig.apache.org

2 users in discussion

Russell Jurney: 1 post Jamal sasha: 1 post

People

Translate

site design / logo © 2021 Grokbase