You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by yo...@wipro.com on 2012/07/26 09:01:14 UTC

Count(*) operation in PIG

Hi All,

I having a structure
AA: {roll: bytearray, job: bytearray,name: bytearray}

(12,yahoo,Yogesh)
(13,google,Mohit)
(14,L.K.G ,Aashi)
(15,School,Renu)
(16,tcs,Rajat)
(12,yahoo, Vishu)
(13,google, Yogesh)
(14,rediff, Mohit)
(15,wipro, Amit)
(16,tcs, Nikhil)



I want to count the no: of repetition of roll, or on another repeated fields, like as we do in SQL select count(*) .


Please suggest me

Thanks & Regards
Yogesh Kumar



Please do not print this email unless it is absolutely necessary. 

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 

www.wipro.com

Re: Count(*) operation in PIG

Posted by Russell Jurney <ru...@gmail.com>.
answer = foreach (group AA by roll) generate group as roll,
COUNT_STAR(AA) as total;

Russell Jurney http://datasyndrome.com

On Jul 26, 2012, at 6:47 AM, Alex Rovner <al...@gmail.com> wrote:

> What pig version are you using? I believe latest versions support COUNT(*)
>
> Sent from my iPhone
>
> On Jul 26, 2012, at 3:01 AM, <yo...@wipro.com> wrote:
>
>> Hi All,
>>
>> I having a structure
>> AA: {roll: bytearray, job: bytearray,name: bytearray}
>>
>> (12,yahoo,Yogesh)
>> (13,google,Mohit)
>> (14,L.K.G ,Aashi)
>> (15,School,Renu)
>> (16,tcs,Rajat)
>> (12,yahoo, Vishu)
>> (13,google, Yogesh)
>> (14,rediff, Mohit)
>> (15,wipro, Amit)
>> (16,tcs, Nikhil)
>>
>>
>>
>> I want to count the no: of repetition of roll, or on another repeated fields, like as we do in SQL select count(*) .
>>
>>
>> Please suggest me
>>
>> Thanks & Regards
>> Yogesh Kumar
>>
>>
>>
>> Please do not print this email unless it is absolutely necessary.
>>
>> The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
>>
>> WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
>>
>> www.wipro.com

Re: Count(*) operation in PIG

Posted by Alex Rovner <al...@gmail.com>.
What pig version are you using? I believe latest versions support COUNT(*)

Sent from my iPhone

On Jul 26, 2012, at 3:01 AM, <yo...@wipro.com> wrote:

> Hi All,
> 
> I having a structure
> AA: {roll: bytearray, job: bytearray,name: bytearray}
> 
> (12,yahoo,Yogesh)
> (13,google,Mohit)
> (14,L.K.G ,Aashi)
> (15,School,Renu)
> (16,tcs,Rajat)
> (12,yahoo, Vishu)
> (13,google, Yogesh)
> (14,rediff, Mohit)
> (15,wipro, Amit)
> (16,tcs, Nikhil)
> 
> 
> 
> I want to count the no: of repetition of roll, or on another repeated fields, like as we do in SQL select count(*) .
> 
> 
> Please suggest me
> 
> Thanks & Regards
> Yogesh Kumar
> 
> 
> 
> Please do not print this email unless it is absolutely necessary. 
> 
> The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments. 
> 
> WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email. 
> 
> www.wipro.com