Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig, mail # user - Sum and count of fields


Copy link to this message
-
Re: Sum and count of fields
Prashant Kommireddi 2012-04-15, 05:52
You mean count of distinct elements at f5?

Sent from my iPhone

On Apr 14, 2012, at 10:44 PM, Shin Chan <[EMAIL PROTECTED]> wrote:

> Hi
>
> I have data something like
>
> f1,f2,f3,f4,f5
>
> Rows with 5 fields
>
> I have to produce final dump output as
>
> f1,f2,f3, SUM( all fields at f4 position) , COUNT ( number of fields at f5 position ) , f4 , f5
>
> I am trying to do using group , foreach , flatten but its getting confusing. Since flatten produce cross product i am getting lots of rows.
> My final output should have same number of rows as input but with SUM , COUNT columns added.
>
> Thanks in advance for your help