mmm In fact TOP doesn't order results. I was looking for a way to do this from PIG. The problem is TOP returns a bag which cannot be ordered. And of course after the foreach its to late.
2011/4/26 Sven Krasser <kras...@gmail.com> > At a glance it could be this: The first field in D.A is of type chararray, > but TOP orders based on long. > -Sven > > On Tue, Apr 26, 2011 at 6:11 AM, ugo jardonnet <ugo.jardon...@gmail.com > >wrote: > > > Hi. I am looking for a way to get the result of top ordered. Is it > possible > > ? > > > > Example: > > > > A = LOAD 'datatest' USING PigStorage(';') as (first: chararray, second: > > int); > > D = GROUP A BY first; > > topResults = FOREACH D { > > result = TOP(3, 1, A); > > GENERATE flatten(result); -- unordered > > }; > > dump topResults > > > > best, > > > > > > -- > http://sites.google.com/site/krasser/ >