Return-Path: X-Original-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Delivered-To: apmail-hadoop-mapreduce-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 99DDDEEA6 for ; Tue, 12 Mar 2013 17:31:38 +0000 (UTC) Received: (qmail 25915 invoked by uid 500); 12 Mar 2013 17:21:22 -0000 Delivered-To: apmail-hadoop-mapreduce-user-archive@hadoop.apache.org Received: (qmail 23492 invoked by uid 500); 12 Mar 2013 17:20:56 -0000 Mailing-List: contact user-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hadoop.apache.org Delivered-To: mailing list user@hadoop.apache.org Received: (qmail 8912 invoked by uid 99); 12 Mar 2013 12:35:26 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Mar 2013 12:35:26 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_NEUTRAL X-Spam-Check-By: apache.org Received-SPF: neutral (athena.apache.org: local policy) Received: from [209.85.219.46] (HELO mail-oa0-f46.google.com) (209.85.219.46) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 12 Mar 2013 12:35:21 +0000 Received: by mail-oa0-f46.google.com with SMTP id k1so5656575oag.5 for ; Tue, 12 Mar 2013 05:35:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to :content-type:x-gm-message-state; bh=BW1SjozORUekrouJNpJN76ISVPliRovVHGPv4uVhNIE=; b=F7XutQqVEhguoU8k8m4IaM+5eGNLnMy1cfZYI8JwOkCubmyTFcRkVED1eGrVag3UGb UKXNcuWLCsFOwyVO7afT7wDGl0zWYo+rnFo7pBwugRaZDFE40vgjtUORrMoK5HVmvBwx GOZbudhj1ZIjN5PEndEwUVZ5XEnG4+19E3dRwSig8gA8nzAzjfvE2j6fqEsHn/+XWJ+6 sgl3EAERZLWedRtiaFA3cF0Ck0gGVBum/jK5YjmIwni3RF6VCQCFANaqPV58kwyvhEV9 de2EY2h9yccvJN5nt1IElDWUislxfhu7gtDTEmRSOzvs+z9IBLHYcBo9EATNWdpS0rTO 9Izg== MIME-Version: 1.0 X-Received: by 10.182.115.34 with SMTP id jl2mr12004273obb.9.1363091700477; Tue, 12 Mar 2013 05:35:00 -0700 (PDT) Received: by 10.60.0.195 with HTTP; Tue, 12 Mar 2013 05:35:00 -0700 (PDT) Date: Tue, 12 Mar 2013 16:35:00 +0400 Message-ID: Subject: Multiple output From: Fatih Haltas To: "user@hadoop.apache.org" Content-Type: multipart/alternative; boundary=f46d044481419a7ee304d7b98402 X-Gm-Message-State: ALoCoQm7b+qYkOQUZ/cYJEJvk65JKQPrjSYCNoBtG7HpEZaCrsN1K5+TYNaDspDAYVk63YQTY629 X-Virus-Checked: Checked by ClamAV on apache.org --f46d044481419a7ee304d7b98402 Content-Type: text/plain; charset=ISO-8859-1 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 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 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 { public void reduce(Text key,Iterable values, Context context) throws IOException, InterruptedException { Iterator 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)); } } } --f46d044481419a7ee304d7b98402 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Everyone,

I would l= ike to have 2 different output (having different columns of a same input te= xt file.)=A0
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&l= t;iterable> kind of things/is there context array/is it possible to have= two different context object as reducer output by changing the "publi= c =A0void reduce(Text key,Iterable<Text> values, Context context)&quo= t; 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 Redu= cer<Text,Text,Text,Text>
=A0=A0 =A0 =A0 =A0{
=A0=A0 =A0 =A0 =A0 p= ublic =A0void reduce(Text key,Iterable<Text> values, Context context)= throws IOException,
=A0=A0 =A0 =A0 =A0 =A0 = =A0InterruptedException
=A0=A0 =A0 =A0 =A0 =A0 =A0{
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Iterator<Text>= iter =3D values.iterator();
=A0=A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0while(iter.hasNext())
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0{
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Text externalip_starttime_endtime =3D iter.ne= xt();
=A0=A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Text outValue =3D new Text(externalip_starttime_endtime);
=A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 con= text.write(key, new Text(outValue));
=A0=A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0
=A0=A0 =A0 =A0= =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0} =A0 =A0 =A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0 =A0=A0 =
=A0=A0 =A0 =A0 =A0 =A0 = =A0 =A0 =A0 =A0 =A0=A0
=A0=A0 =A0 =A0 =A0 =A0 =A0}
=A0=A0 =A0 =A0 =A0}
<= /div>
--f46d044481419a7ee304d7b98402--