Jig232
Jig232

Reputation: 37

Pig count query

I have to find out the number of students who scored less than 5. I have loaded the file. I am using a filter for grade< 5
I am not getting how to take the count now. Can anyone please help

Upvotes: 0

Views: 221

Answers (1)

nobody
nobody

Reputation: 11080

Refer to COUNT

A = LOAD 'student.csv' using PigStorage(',') as (name:chararray,grade:int);
B = FILTER A by grade < 5;
C = GROUP B BY name;
D = FOREACH C GENERATE COUNT(B);
DUMP D;

Upvotes: 2

Related Questions