Hi, It is possible to reverse the sort order. You can define a new WritableComparator for the relevant WritableComparable to reverse the order, and then call job.setKeyComparator() specifying the class of your new WritableComparator, when configuring the job.
Alternatively, create a new WritableComparable containing the same data as the old one but where the compareTo() method reverses the order. Regards, James On Wed, Oct 20, 2010 at 11:11 PM, Johannes.Lichtenberger < [email protected]> wrote: > Hi, > > is it possible to reverse the sort-order? I mean, it seems the reducers > are getting the output in descending order. As I want to sort wikipedia > revisions of articles it would be great in ascending order. Now the > output on a simple little test file is (sorted/grouped automatically by > Map/Reduce): > > > <page><id>774932</id><title>foo</title><revision><id>89865</id><timestamp>2003-11-21T02:12:21Z</timestamp><text>dshajkl</text></revision></page> > > <page><id>774932</id><title>foo</title><revision><id>233192</id><timestamp>2002-12-20T02:12:21Z</timestamp><text>blaaaaa</text></revision></page> > > <page><id>732819</id><title>blubb</title><revision><id>233192</id><timestamp>2001-02-21T02:12:21Z</timestamp><text>tztztz</text></revision></page> > > <page><id>372819</id><title>bla</title><revision><id>233192</id><timestamp>2001-01-21T02:12:21Z</timestamp><text>blaaaaa</text></revision><revision><id>e7777</id><timestamp>2001-01-21T02:12:21Z</timestamp><text>blubb</text></revision></page> > > <page><id>732819</id><title>blubb</title><revision><id>233192</id><timestamp>2000-01-20T02:12:21Z</timestamp><text>blaaaaa</text></revision></page> > > The reverse order would be great. > > BTW: I would like to add a root-Element, since XML requires a root node. > I assume it's not possible to determine if the first and last reduce-Job > is running!? > > regards, > Johannes > -- James Hammerton | Senior Data Mining Engineer www.mendeley.com/profiles/james-hammerton Mendeley Limited | London, UK | www.mendeley.com Registered in England and Wales | Company Number 6419015
