Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

Split tuple with multiple fields to tuples with single field in Pig

$
0
0
Hi pig-users,

I have tuples with varied length. I am trying to convert them to tuples with only one field (each field is a map).
Original data:
([symbol#HIG,security_type#EQUITY,foreign_entry_id#743094])
([symbol#PEW,security_type#EQUITY,foreign_entry_id#743084])
([symbol#AFFY,security_type#EQUITY,foreign_entry_id#5585],[symbol#RFG,security_type#ETF,foreign_entry_id#5586],[symbol#SCHW,security_type#EQUITY,foreign_entry_id#5587],[symbol#VWO,security_type#ETF,foreign_entry_id#5588])

I hope the output would be:
([symbol#HIG,security_type#EQUITY,foreign_entry_id#743094])
([symbol#PEW,security_type#EQUITY,foreign_entry_id#743084])
([symbol#AFFY,security_type#EQUITY,foreign_entry_id#5585])
([symbol#RFG,security_type#ETF,foreign_entry_id#5586])
([symbol#SCHW,security_type#EQUITY,foreign_entry_id#5587])
([symbol#VWO,security_type#ETF,foreign_entry_id#5588])

I have tried: FOREACH entryArray GENERATE FLATTEN(TOBAG(*));
It returns (only the first field of each tuple):
([symbol#HIG,security_type#EQUITY,foreign_entry_id#743094])
([symbol#PEW,security_type#EQUITY,foreign_entry_id#743084])
([symbol#AFFY,security_type#EQUITY,foreign_entry_id#5585])

Any suggestion would be very appreciated. Thanks!

Regards,

Dan

Viewing all articles
Browse latest Browse all 5648

Trending Articles