You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@pig.apache.org by Danfeng Li <dl...@operasolutions.com> on 2012/12/29 02:44:02 UTC

self cross doesn't work as expected

If I self cross a relation, I got the original relation, which is not expected.

The input: A.txt
1
2
3

The code:
A = load 'A.txt' as (id:chararray);
B = cross A, A;
dump B;
(1)
(2)
(3)

C = foreach A generate id;
D = cross A, C;
dump D;
(1,1)
(1,2)
(1,3)
(2,1)
(2,2)
(2,3)
(3,1)
(3,2)
(3,3)

Is this a feature, or a bag? I'm using pig 0.10.0

Thanks.
Dan

Re: self cross doesn't work as expected

Posted by TianYi Zhu <ti...@facilitatedigital.com>.
It's not a bug, pig works in that way avoiding the field name conflict
issue. You need to load the data twice when you do self join/group/cross.


On 29 December 2012 12:44, Danfeng Li <dl...@operasolutions.com> wrote:

> If I self cross a relation, I got the original relation, which is not
> expected.
>
> The input: A.txt
> 1
> 2
> 3
>
> The code:
> A = load 'A.txt' as (id:chararray);
> B = cross A, A;
> dump B;
> (1)
> (2)
> (3)
>
> C = foreach A generate id;
> D = cross A, C;
> dump D;
> (1,1)
> (1,2)
> (1,3)
> (2,1)
> (2,2)
> (2,3)
> (3,1)
> (3,2)
> (3,3)
>
> Is this a feature, or a bag? I'm using pig 0.10.0
>
> Thanks.
> Dan
>