Search code examples
hadoopapache-pig

Pig: how to retrieve difference between two consecutive tuples. (int type)


Suppose my Data is as follows: (XXX,{(1),(2),(3)})

I will need the difference between tuples inside given bag. (there can be n number of tuples.)

Output i am expecting: (XXX,2)

Is it possible without using UDF? Thanks in advance.


Solution

  • You need to flatten bag and then apply filter on the flatten dataset to select appropiate