Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Pig >> mail # user >> FLATTEN is not working


Copy link to this message
-
Re: FLATTEN is not working
I used below script and got the desired output. Thanks for the reply

A =foreach Z generate $0 as id, FLATTEN(TOBAG(*)) as value;

I have another question

Currently the input is as below
xxxxx   11,22,33        44,55,66        77,88,99

Suppose if input is as below

xxxxx  11,22,33         44,55,66        77,88,99
yyyyy  12,23              34,45            56,67
zzzzz  1,2,3,4            5,6,7,8,9       66,77,88,99

And the output needs to be as follows

xxxx     11 44 77
xxxx     22 55 88
xxxx     33 66 99
yyyy     12 34 56
yyyy     23 45 67
zzzz     1   5   66
zzzz     2   6   77
zzzz     3   7   88
zzzz     4   8   99

So basically, input can have variable values in each filed. How can we
replace the script?
On Thu, Mar 7, 2013 at 7:03 AM, Mix Nin <[EMAIL PROTECTED]> wrote:

> Hi Harsha,
>
> I am getting output as  below with the new script. It is not transposed
>
> (xxxxx,(11,44,77),(22,55,88),(33,66,99))
>
>
> Also , there is no guarantee that in input that there would be only 3
> values in each field separated by comma(,). There can be variable number of
> values.
>
> Thanks
>
>
>