Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

how to create multiple tuples from single tuple in pig.

Highlighted

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
Highlighted

Re: how to create multiple tuples from single tuple in pig.

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

Highlighted

Re: how to create multiple tuples from single tuple in pig.

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

Highlighted

Re: how to create multiple tuples from single tuple in pig.

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
Highlighted

Re: how to create multiple tuples from single tuple in pig.

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

Don't have an account?
Coming from Hortonworks? Activate your account here