FAQ
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 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.

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 5 | next ›
Discussion Overview
groupcommon-user @
categorieshadoop
postedAug 9, '07 at 4:37p
activeAug 13, '07 at 11:34p
posts5
users3
websitehadoop.apache.org...
irc#hadoop

People

Translate

site design / logo © 2022 Grokbase