Flatten a bag to a specific datatype

2011-06-22 Thread Jonathan Holloway
I'm having trouble trying to flatten a bag to a tuple of int's in Pig, e.g. {(12),(4),(7),(190)} to: (12,4,7,190) It seems like it should be trivial to do, but not quite sure how to do it. Can this by done with inbuilt Pig commands or do i need a custom UDF or an exec? Many thanks, Jon.

Re: Flatten a bag to a specific datatype

2011-06-22 Thread Aniket Mokashi
Hi, I think UDF BagToTuple should do it for you. From some old email thread, I find (I think you will have to change getBagField to get etc)-- public class BagToTuple extends EvalFuncTuple{ @Override public void exec(Tuple input, Tuple output) throws IOException{ DataBag bag =