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 >> question


>
>    I have a data file in format
>
>
>
> User, movie, price
>
> 123,abc,22.2
>
> 123,daw,39
>
> 123,abc,99  ß Note that the user and movie is same but price is different
>
>
>
> I want to generate a pig script where I am counting how many times a user
has rented a particular movie
>
>
>
>
>
> in = LOAD 'data' USING PigStorage('\\u001') AS ( user:long, movie: long,
price: float)
>
>
>
> filtered_times = FILTER in BY price>0;
>
> perCust = GROUP filtered_times BY (user,movie);
>
>
>
> count = foreach perCust generate group, COUNT(filtered_times.movie);
>
> STORE count INTO 'results' using PigStorage(',');
>
>
>
> The out put is like:
>
> (3710100987700,5460986508),14
>
>
>
> I don’t want these braces L
>
> I want like normal delimited by ","
+
Arun Ahuja 2012-10-12, 15:27
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