Try:

a = foreach grouped generate seedword, baggy.outertup as tup;
b = foreach grouped generate seedword, flatten(tup.groupy) as (coword);

do you think you could post a script that gets you to the grouped part of
it? It would make it much easier to help you.

2012/1/12 Yulia Tolskaya <[email protected]>

> That did not work I get an error of :
> Cannot find field coword in groupy:tuple(seedword:chararray,coward:char
> array)
> IF I try
> FOREACH grouped GENERATE seedword, baggy.groupy;
> I also get an error:
> Invalid field reference. Referenced field [groupy] does not exist in
> schema: seedword:chararray,coward:char array.  (so it does seem to be
> ignoring all the nested tuples).
>
> This does seem like a bug!
> Can you think of a better solution? I could write a UDF to get rid of the
> nested tuples, but that really seems unnecessary.
>
> Thank you
>
> Yulia
>
>
> On 1/12/12 2:50 PM, "Jonathan Coveney" <[email protected]> wrote:
>
> >Hmm, this is an interesting case. I think there may be a bug here.
> >
> >grunt> grouped = load 'thing' as
> >(seedword:chararray,baggy:{outertup:(groupy:(seedword:chararray,
> >coword:chararray))});
> >grunt> describe grouped;
> >grouped: {seedword: chararray,baggy: {groupy: (seedword: chararray,coword:
> >chararray)}}
> >
> >notice that outertup has been thrown out. I suppose having a bunch of
> >nested tuples is equivalent to getting rid of them, still, it's not
> >something that pig should do. For the Pig devs, is this expected?
> >
> >Either way. in this case, you would do:
> >
> >a = foreach grouped generate seedword, baggy.coword;
> >
> >and go for there
> >
> >let me know if that works
> >
> >2012/1/12 Yulia Tolskaya <[email protected]>
> >
> >> I have been stuck on this for several hours and I cannot figure out
> >>what I
> >> am doing wrong. I have a relation "grouped" with the schema of
> >>
> >>  grouped: {seedword: chararray,baggy: {outertup: (groupy: (seedword:
> >> chararray,coword: chararray))}}
> >>
> >> I need to generate just the seedword and a tuple of cowords. In my
> >>example
> >> I would want
> >>
> >> (auto, (car, truck)).
> >>
> >> I have tried:
> >>
> >>  FOREACH grouped GENERATE baggy::outertup.groupy.coword;
> >>
> >>  FOREACH grouped GENERATE baggy.outertup.groupy.coword;
> >>  FOREACH grouped GENERATE baggy.groupy.coword;
> >>
> >>
> >> and none of these (or other similar variations) work, and give me error
> >> messages saying there is no such field. I"m assuming there has to be a
> >>way
> >> to do this. Please help!!
> >>
> >>
> >> Yulia
> >>
> >>
>
>

Reply via email to