if you are using pig 0.12+ then in the piggybank you have stich and over function using which you can do lead and lag
On Wed, Oct 8, 2014 at 11:31 AM, Krishna Kalyan <krishnakaly...@gmail.com> wrote: > Hi Everybody, > > Input File : Records are sorted based on the time stamp > Expected input file size will be :2-3TB > > timestamp > ============== > 20141014120523 > 20141014120534 > 20141014120537 > 20141014120542 > 20141014120549 > 20141014120555 > 20141014120565 > 20141014120570 > 20141014120512 > ... > ... > > > Using PIG I need to find the time difference between the Nth record and > Nth-1 Record time stamp (20141014120534 - 20141014120523 = 11 secs). > I need to loop through all the records to get the time difference from > previous record > > Example Output > 0 > 11 > 3 > 5 > ... > > Please guide. > > Regards, > Krishna Kalyan > -- Nitin Pawar