The 'TOBAG' is what you're looking for, perhaps? http://pig.apache.org/docs/r0.13.0/func.html#tobag
You can project-range into a TOBAG too. Regards, On 22 February 2015 at 06:21, Erik Burrows <[email protected]> wrote: > Hi All, > I have a question regarding restructuring records in Pig. I have a data > set which looks something like: > > (user, nAddresses, address1, address2, phone, ...) > > I want to collapse the addressX group of fields into a bag, like: > > (user, (address1, address2, ...), phone, ...) > > Is there a way to do this with Pig's built-in functions or operators? > > Project-Range expressions get me close, but I don't see a way to do > something like: ($0, $3 .. $$1, $4, ...). > > I looked at writing a UDF, but I don't see a model for this. Do all UDFs > return only scalars or booleans, but not bags? > > Thanks, > -Erik Burrows > > >
