Hi,

   I have data in following format:

userid, unixtimestamp, duration
 1,123,10
  1,124,15
  1,200, 20
  1,204,20
   2, 32,310

and so on..

The list is already sorted by user id and then unixtimestamp...

I want to do an id assignment based on following rule...
What I want is.. if between two consecutive entries for each user..
if unixtimestamp_i+1 <= unix_timestamp_i + duration_i, then assign
unixtimestamp_i  and unix_timestamp_i+1 with same id.. else different ids..

For example above..

1,123,10, "id1"
1,124,15,"id1"  (124 < 123+10)
1,200,20,"id2" (200 > 124+15)
1,204,20, "id2" (204<200+20)

and so on for other userids..

How do i do this in pig

Reply via email to