Hi,

the framework doesn't give you the first/last information about reduce
job you perform in your reducer. Just as the mapper doesn't give you
information whether the (key, value) pair passed to map function is
first/last for a given key. However you can workaround this by adding
special values to your data, e.g. <page><id>0</id>... and
<page><id>Long.MAX_VALUE</id>.... When you encounter those in your
reducer, you know you are at the beginning/end of your data and you
can emit <root> and </root>.

Regards,
Pawel

2010/10/21 Johannes.Lichtenberger <[email protected]>:
> 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
>

Reply via email to