Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hadoop >> mail # user >> Re: Multiple outputs


Copy link to this message
-
Re: Multiple outputs
MultipleOutputs is the way to go :)

On Tue, Mar 12, 2013 at 12:48 PM, Fatih Haltas <[EMAIL PROTECTED]> wrote:
> Hi Everyone,
>
> I would like to have 2 different output (having different columns of a same
> input text file.)
> When I googled a bit, I got multipleoutputs classes, is this the common way
> of doing it or is there any way to create context<iterable> kind of
> things/is there context array/is it possible to have two different context
> object as reducer output by changing the "public  void reduce(Text
> key,Iterable<Text> values, Context context)" part as one more Context
> context1, Context context2) ?
>
> Any help will be appraciated.
> Thank you very much.
>
>
>
>
> Below is my reducer function, how should I modify it?
>
>
>
> static class MyReducer extends Reducer<Text,Text,Text,Text>
>        {
>         public  void reduce(Text key,Iterable<Text> values, Context context)
> throws IOException,
>            InterruptedException
>            {
>                     Iterator<Text> iter = values.iterator();
>                            while(iter.hasNext())
>                            {
>                             Text externalip_starttime_endtime = iter.next();
>                             Text outValue = new
> Text(externalip_starttime_endtime);
>                             context.write(key, new Text(outValue));
>
>                            }
>
>            }
>        }

--
Harsh J
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB