This approach may not combine the results as per the key to reduce function.

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Miles
Osborne
Sent: Thursday, July 09, 2009 10:03 AM
To: [email protected]
Subject: Re: Sort by value

if you have <key,value> pairs, then have your mapper emit

<value,<key,value>>     

this will result in your data being resorted by the value

Miles

2009/7/9 Marcus Herou <[email protected]>

> Really ? WIll that work ?
>
> input something like this
>
> tag
> tag2
> tag
> tag2
> tag3
> ...
> produces output
>
> tag 2
> tag2 2
> tag3 1
> ....
>
> Swapping key/value will then map all 2's to what ?
>
>
>
> On Thu, Jul 9, 2009 at 4:53 PM, jason hadoop <[email protected]>
> wrote:
>
> > The simplest way is to swap the key and value in your mapper's output,
> then
> > swap them back afterward.
> >
> > On Thu, Jul 9, 2009 at 7:52 AM, Marcus Herou <[email protected]
> > >wrote:
> >
> > > Hi many times I want to sort by value instead of key.
> > >
> > > For instance when counting the top used tags in blog posts or the ten
> > most
> > > visited pages on a certain site and so on.
> > >
> > > Wondering if that is even possible with hadopp or if I need to process
> > the
> > > file outside of hadoop.
> > >
> > > Cheers
> > >
> > > /Marcus
> > >
> > > --
> > > Marcus Herou CTO and co-founder Tailsweep AB
> > > +46702561312
> > > [email protected]
> > > http://www.tailsweep.com/
> > >
> >
> >
> >
> > --
> > Pro Hadoop, a book to guide you from beginner to hadoop mastery,
> > http://www.amazon.com/dp/1430219424?tag=jewlerymall
> > www.prohadoopbook.com a community for Hadoop Professionals
> >
>
>
>
> --
> Marcus Herou CTO and co-founder Tailsweep AB
> +46702561312
> [email protected]
> http://www.tailsweep.com/
>



-- 
The University of Edinburgh is a charitable body, registered in Scotland,
with registration number SC005336.

Reply via email to