Hi John,
Here is the example, where you can change the filename specified in the conf.
protected String generateFileNameForKeyValue(Object key, Object value,
String name) {
return name.concat(key.toString() + "_" + name);
return keyBasedName;
}
--
vibhooti
On Mon, Aug 17, 2009 at 1:59 PM, John Clarke <[email protected]> wrote:
> Fantastic, I will try that :) A little push in the right driection helps
> hugely! I don't have that book yet but I'm planning on getting it.
>
> cheers
> John,
>
>
>
> 2009/8/14 Kris Jirapinyo <[email protected]>
>
> > Hi John,
> > If you have the Hadoop O'Reilly book, look at pg 206 for an example.
> > But basically, you just create a subclass of MultipleTextOutputFormat and
> > then inside it you override generateFileNameForKeyValue (for example) to
> > have the reducer emit the desired filenames. For each key in the
> reducer,
> > it will write the text values to that file. Make sure in the JobConf you
> > set OutputFormat to your class that extends MultipleTextOutputFormat.
> >
> > -- Kris.
> >
> > On Fri, Aug 14, 2009 at 7:11 AM, John Clarke <[email protected]>
> wrote:
> >
> > > Hi,
> > >
> > > I want to output two text files from my MapReduce job but I am having
> > > trouble understanding how to use the MultipleTextOutputFormat class to
> do
> > > so.
> > >
> > > I want to write to the two files depending on the key of each key/value
> > > pair.
> > >
> > > In the Reducer how do I tell it to write the different files? Normally
> I
> > > just do an output.collect(key, val);.
> > >
> > > Any help would be most appreciated.
> > >
> > > Thanks,
> > > John
> > >
> >
>
--
cheers,
Vibhooti