How can i find each professional count and age count of a particular country( for eg US) in pig

27 Views Asked by At

enter image description here

this is the example. from this i want to find each professional count and each age group count.

enter image description here

filter_data = FILTER customer by loc=='us';          
grunt> grp_data1 = GROUP filter_data by age;                                   
grunt> cnt_data = FOREACH grp_data1 generate group,COUNT(customer);
1

There are 1 best solutions below

0
Janani On

You are trying to use a GROUP BY statement using filter_data. So, the same variable name has to be used inside COUNT function.

grunt> grp_data1 = GROUP filter_data by age;                                   
grunt> cnt_data = FOREACH grp_data1 generate group, COUNT(filter_data);