mano
mano

Reputation: 21

how to count number of rows in a relation in pig

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.

Upvotes: 2

Views: 2458

Answers (1)

nobody
nobody

Reputation: 11090

Assuming your relation is named A.

B = GROUP A ALL;
B_COUNT = FOREACH B GENERATE COUNT(A);
DUMP B_COUNT;

Upvotes: 3

Related Questions