Support Questions
Find answers, ask questions, and share your expertise

how to create multiple tuples from single tuple in pig.

Hello All,

I have column like '5060-5070' in pig and I want to write a udf to return tuples as below:

col1 and col2 will be same in all the tuples.

col1,col2,5060,....

col1,col2,5061,..

col1,col2,5062,..

or if there is any alternative (instead of using udf) to create multiple tuples from single tuple .

kindly help...!!

4 REPLIES 4

I do not believe there is a way to do this in "native" Pig Latin and you will need to introduce a UDF.

yeah... i wrote a udf and its working absolutely fine.thnx

capture1.png

manpreet kaur

I cant think of anyway other than creating a udf in pig. Whereas in hive it can achieved easily with array as datatype along with lateral view explode option.

capture.png


capture1.png

In hive its seems to be easy..but i had to do the same in pig, so I wrote udf, anyways thnx 🙂