@cabad
On the surface, you can see that the RANK operator will work, but you are not guaranteed to have an increasing row identifier without any restrictions on your data.
The problem arises from any rows that are provided to the ranking operator equal, will have the same rank. If you can guarantee that none of the two lines have equal ranking fields, then this approach may work, but I think I would put it in the round-hole approach.
See this example from [docs] http://pig.apache.org/docs/r0.11.0/basic.html#rank (takes 2, 6, 10):
C = rank A by f1 DESC, f2 ASC; dump C; (1,Tete,2,N) (2,Ranjit,3,M) (2,Ranjit,3,P) (4,Michael,8,T) (5,Jose,10,V) (6,Jillian,8,Q) (6,Jillian,8,Q) (8,JaePak,7,Q) (9,David,1,N) (10,David,4,Q) (10,David,4,Q)