Note bag is a collection of tuples, so { {(1,2,3)},{(1,3)} } should be
{ ({(1,2,3)}),({(1,3)}) }. The bag syntax will be supported in 0.10
coming soon, see PIG-1387.Daniel On Fri, Mar 23, 2012 at 8:24 PM, Yongzhi Wang <[email protected]> wrote: > Hi, All > > I was wondering if Pig script can support to create a data bag containing > several sub data bags. > > For example, in the below script, > > C = COGROUP A BY a1 inner, B BY b1 inner; > > DUMP C; > (1,{(1,2,3)},{(1,3)}) > (4,{(4,2,1),(4,3,3)},{(4,6),(4,9)}) > (8,{(8,3,4),(8,4,3)},{(8,9)}) > > > how can I construct bags like { {(1,2,3)},{(1,3)} }, { > {(4,2,1),(4,3,3)},{(4,6),(4,9)} }, { {(8,3,4),(8,4,3)},{(8,9)} }. in the > "FOREACH" statement. > > I tried something like > > FOREACH C GENERATE group, {$1, $2}; > > But I got "Syntax error, unexpected symbol at or near '{'" error. > > Thanks!
