We have data with similar schemas as below and we'd like to acces the
field C.B.A.(x, y)

C: {group: chararray,B: {group: chararray,A: {x: chararray,y: int, z:blabla}}}

The query in my original email is used to demonstrate it is possible
to generate data with such schema using Pig scripts; and should it be
supported to access C.B.A(x)?

Best,
Lin


On Thu, Dec 9, 2010 at 3:49 PM, Kris Coward <[email protected]> wrote:
>
> Dare I ask why such a query would be used? AFAICT the second group
> operation would just stick each record in a bag and create an extra
> copy of group on the outside of the bag (but use up a lot more
> computational power than a UDF that would just do the same thing
> explicitly).
>
> Cheers,
> Kris
>
> On Thu, Dec 09, 2010 at 03:34:58PM -0800, Lin Guo wrote:
>> A = load 'foo.txt' using PigStorage as (x : chararray, y : int);
>>
>> B = group A by x;
>> C = group B by group;
>> describe C;
>>
>> -- we got
>> -- C: {group: chararray,B: {group: chararray,A: {x: chararray,y: int}}}
>>
>> D = foreach C generate B.(group, A);  -- this works
>> describe D;
>>
>> E = foreach C generate B.(group, A.(x));
>> describe E;
>> --- pig returns syntax error, but should this work? Or is there a patch for 
>> it?
>>
>> thanks,
>> lin
>
> --
> Kris Coward                                     http://unripe.melon.org/
> GPG Fingerprint: 2BF3 957D 310A FEEC 4733  830E 21A4 05C7 1FEB 12B3
>

Reply via email to