pig-user  

RE: how to get the size of a data bag

Olga Natkovich
Fri, 18 Jul 2008 14:22:15 -0700

How was you bag created?

Normally, you would load the data then group it into a bag using group
by or group all and then apply the count:

A = load 'input';
B = group A all;
C = foreach A generate COUNT(A);

Olga 

> -----Original Message-----
> From: charles du [EMAIL PROTECTED] 
> Sent: Friday, July 18, 2008 12:23 PM
> To: pig-user@incubator.apache.org
> Subject: how to get the size of a data bag
> 
> Hi:
> 
> Just start learning hadoop and pig latin. How can I get the 
> number of elements in a data bag?
> 
> For example, a data bag like follow has four elements.
>   B= {1, 2, 3, 5}
> 
> I tried C = COUNT(B), it did not work. Thanks.
> 
> --
> tp
>