Re: How to use TOP?

2012-05-22 Thread Mohammad Tariq
Yes, it would be better if I do it at the time of insertion.Just have to add one more column.Thanks again. Regards,     Mohammad Tariq On Tue, May 22, 2012 at 2:36 PM, Abhinav Neelam wrote: > Doing it in the pig script is not feasible because pig doesn't have any > notion of sequentiality - to

Re: How to use TOP?

2012-05-22 Thread Abhinav Neelam
Doing it in the pig script is not feasible because pig doesn't have any notion of sequentiality - to maintain it, you'd need to have access to state that's shared globally by all the mappers and reducers. One way I can think of doing this is to have a UDF that maintains state - perhaps it can maint

Re: How to use TOP?

2012-05-22 Thread Mohammad Tariq
Hi Abhinav, Thanks a lot for the valuable response..Actually I was thinking of doing the same thing, but being new to Pig I thought of asking it on the mailing list first..As far as the data is concerned, second column will always be in ascending order.But I don't think it will be of any help..

Re: How to use TOP?

2012-05-21 Thread Abhinav Neelam
Hey Mohammad, You need to have sorting requirements when you say 'top 5' records. Because relations/bags in Pig are unordered, it's natural to ask: 'top 5 by what parameter?' I'm unfamiliar with HBase, but if your data in HBase has an implicit ordering with say an auto-increment primary key, or an

Re: How to use TOP?

2012-05-21 Thread Mohammad Tariq
Hi Ruslan, Thanks for the response.I think I have made a mistake.Actually I just want the top 5 records each time.I don't have any sorting requirements. Regards,     Mohammad Tariq On Mon, May 21, 2012 at 9:31 PM, Ruslan Al-fakikh wrote: > Hey Mohammad, > > Here > c = TOP(5,3,a); > you say

RE: How to use TOP?

2012-05-21 Thread Ruslan Al-fakikh
Hey Mohammad, Here c = TOP(5,3,a); you say: take 5 records out of a that have the biggest values in the third column. Do you really need that sorting by the third column? -Original Message- From: Mohammad Tariq [mailto:donta...@gmail.com] Sent: Monday, May 21, 2012 3:54 PM To: user@pig.a