Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig >> mail # user >> Re: Sum and count of fields


+
Shin Chan 2012-04-15, 06:22
+
Dmitriy Ryaboy 2012-04-15, 21:48
+
Shin Chan 2012-04-15, 05:44
Copy link to this message
-
Re: Sum and count of fields
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
+
Shin Chan 2012-04-16, 07:39
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB