You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by Jonathan Coveney <jc...@gmail.com> on 2012/06/22 02:51:27 UTC

Bug with BagToTuple?

If I'm not misunderstanding what it should be doing, this looks like an
error to me?


$ cat data

1 1

1 2

1 3

1 4

2 5

2 6

2 7

2 8

3 3

3 10

3 11

4 4

4 42

4 19

5 5

5 52

5 53

5 54


a = load 'data' as (x:int, y:int);

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

c = group a all;

d = foreach c {

    ord = ORDER a BY $0 asc;

    generate BagToTuple(ord);

}


output:

((1,2,1,1,1,3,1,4,2,5,2,6,2,7,2,8,3,10,3,3,3,11,4,4,4,42,4,19,5,5,5,52,5,53,5,54))

Re: Bug with BagToTuple?

Posted by Jonathan Coveney <jc...@gmail.com>.
Ooops bug is a bad alias in my script. Ignore.

2012/6/21 Jonathan Coveney <jc...@gmail.com>

> If I'm not misunderstanding what it should be doing, this looks like an
> error to me?
>
>
> $ cat data
>
> 1 1
>
> 1 2
>
> 1 3
>
> 1 4
>
> 2 5
>
> 2 6
>
> 2 7
>
> 2 8
>
> 3 3
>
> 3 10
>
> 3 11
>
> 4 4
>
> 4 42
>
> 4 19
>
> 5 5
>
> 5 52
>
> 5 53
>
> 5 54
>
>
> a = load 'data' as (x:int, y:int);
>
> b = foreach a generate TOTUPLE(x,y);
>
> c = group a all;
>
> d = foreach c {
>
>     ord = ORDER a BY $0 asc;
>
>     generate BagToTuple(ord);
>
> }
>
>
> output:
>
>
> ((1,2,1,1,1,3,1,4,2,5,2,6,2,7,2,8,3,10,3,3,3,11,4,4,4,42,4,19,5,5,5,52,5,53,5,54))
>
>