Pig doesn't have that facility yet. Moreover, its not very efficient to do this in PIG/MR as it requires synchronization.
However, if this is unavoidable situation for you, following things can be considered 1. Maintaining the seq number details in zookeeper 2. Having a simple structure in HBase table (seqNumber --> Value). You can get a bucket of values (ex: 1000-2000) from this and use it in your UDF. When the range depletes, you have to query/update HBase table (ex: 3000-4000). There are corner cases which needs to be handled. ~Rajesh.B On Sat, May 19, 2012 at 12:04 AM, DIPESH KUMAR SINGH <[email protected]>wrote: > Sorry, if my point was not clear. > > I wish to create a sequence on a pig relation. > > Say For example i have a relation with data: > (John, A-1) > (Jack, B-2) > (Jim, C-1) > > I want to create sequence i.e to add one more column to the relation, like > a counter and keep on increasing the count for each record read. Expected > output should be something like this: > > (If 200 is the start sequence. ) > (John, A-1, 201) > (Jack, B-2, 202) > (Jim, C-1, 203) > > Could you please suggest to proceed on this? > > Thanks, > Dipesh > > On Fri, May 18, 2012 at 6:50 AM, Thejas Nair <[email protected]> > wrote: > > > What do you mean by 'rdbms like sequence' ? > > Thanks, > > Thejas > > > > > > On 5/16/12 10:41 AM, DIPESH KUMAR SINGH wrote: > > > >> I want to create a rdbms like sequence on a Pig relation. > >> > >> Is there any existing UDF which could do this? > >> > >> I am bit new to pig, Kindly suggest how to proceed? > >> > >> > >> Thanks& Regards, > >> > > > > > > > -- > Dipesh Kr. Singh > -- ~Rajesh.B
