hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Miles Osborne <mi...@inf.ed.ac.uk>
Subject Re: Sort by value
Date Thu, 09 Jul 2009 17:03:27 GMT
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 <marcus.herou@tailsweep.com>

> 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 <jason.hadoop@gmail.com>
> 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 <marcus.herou@tailsweep.com
> > >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
> > > marcus.herou@tailsweep.com
> > > 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
> marcus.herou@tailsweep.com
> http://www.tailsweep.com/
>



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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message