Hi Eric,

I think it will be something like A = ORDER Z BY .... (see pg 1 of
PigLatinAdvanced.pdf in the docs).

Cheers,
Shane

On 8/10/07, Eric Palacios <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I'm trying to translate this simple query to PigLatin but i remain stuck in
> the ordering.
>
> Given this table :
>
> (user,item)
> 12  145
> 13  192
> 12  145
> 12  133
> 13  164
> 13  192
> 12  145
>
> i want to run this  :
>
> SELECT user,item,COUNT(*)
> FROM table
> GROUP BY user,item
> ORDER BY COUNT(*) DESC
>
>
>
> I tried this :
>
> X = LOAD 'table.txt';
> Y = GROUP X BY ($0,$1);
> Z = FOREACH X GENERATE group,COUNT($1);
>
> and i get this table:
>
> ((12,133),1)
> ((12,145),3)
> ((13,164),1)
> ((13,192),2)
>
> but i have no clue how to flatten/group this to order it.
>
> I hope this is the right mailing list to talk about Hadoop/Yahoo Pig stuff
>
> Thanks in advance,
>
> Eric.
>

Reply via email to