You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Yang <te...@gmail.com> on 2012/06/28 22:04:18 UTC

nested Tuple(Tuple)

it seems that (at least with 0.10.0 ) I can generate a nested tuple inside
a bag.

but if I want to insert a tuple directly under a tuple, they seem to merge
together into one level directly.

for example

a = load 'a' as (x,y);

b = foreach a generate ((x));

dump b;

the result is just a flat record, instead of nested tuple



but generate {(x)} does work

Re: nested Tuple(Tuple)

Posted by Abhinav Neelam <ab...@gmail.com>.
Yeah, says so in the manual -
"A single element enclosed in parens ( ) like (5) is not considered to be a
tuple but rather an arithmetic operator."
http://pig.apache.org/docs/r0.10.0/basic.html#type-construction

We can always use TOTUPLE. This should work:
a = load 'a' as (x,y);

b = foreach a generate TOTUPLE(TOTUPLE(x));

dump b;

Regards,
Abhinav

On 29 June 2012 01:34, Yang <te...@gmail.com> wrote:

> it seems that (at least with 0.10.0 ) I can generate a nested tuple inside
> a bag.
>
> but if I want to insert a tuple directly under a tuple, they seem to merge
> together into one level directly.
>
> for example
>
> a = load 'a' as (x,y);
>
> b = foreach a generate ((x));
>
> dump b;
>
> the result is just a flat record, instead of nested tuple
>
>
>
> but generate {(x)} does work
>