2

I have a relation in pig named 'A'

(name:gender:zip-code)
(x:m:1234)
(y:f:1234)
(z:m:1245)
(s:f:1235)

How can I get the number of rows in relation A?

I want to get the result as 4.

mano
  • 21
  • 3
  • http://pig.apache.org/docs/r0.9.2/func.html#count and http://stackoverflow.com/questions/9900761/pig-how-to-count-a-number-of-rows-in-alias – Kishan Patel Mar 07 '17 at 05:33

1 Answers1

3

Assuming your relation is named A.

B = GROUP A ALL;
B_COUNT = FOREACH B GENERATE COUNT(A);
DUMP B_COUNT;
nobody
  • 10,892
  • 8
  • 45
  • 63