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

Switch to Threaded View
Pig >> mail # user >> Rank within a group

Copy link to this message
Rank within a group
Is there a way to do RANK within a group in PIG 0.11.1?

In the following sample dataset, I would like to Rank DESC by Income, and
further RANK by Income for  each Industry.

Name  Industry Income

John,Banking, 20,000
Jane, Banking, 35,000
Chen,Real Estate, 30,000
Hari, Real Estate, 22,000
Asha, Technology, 26,000

I tried something like this, but I get syntax error.

names_by_ind = group names by industry;

rank_by_ind = foreach names_by_ind {
results = RANK names BY income DESC;
GENERATE flatten(results);