title: Hadoop - Produce multiple values for a single key
body: <p>I was able to successfully change the <strong>wordcount</strong> program in hadoop to suit my requirement. However, I have another situation where in I use the same key for 3 values. Let's say my input file is as below. </p>
  
  <pre><code>A Uppercase 1 firstnumber  I  romannumber a lowercase
  B Uppercase 2 secondnumber II romannumber b lowercase
  </code></pre>
  
  <p>Currently in my map/reduce program, I am doing something like below. Here A is the key and 1 is the value. </p>
  
  <pre><code>A 1
  </code></pre>
  
  <p>I need my map reduce to perform something like below.</p>
  
  <pre><code>A 1 I a 
  </code></pre>
  
  <p>I can do them in 3 different programs like below and can produce the output. </p>
  
  <pre><code>A 1
  A I
  A a
  </code></pre>
  
  <p>However, I want them to do in a single program itself. Basically, from my map function I want to do this. </p>
  
  <pre><code>context.write(key,value1);
  context.write(key,value2);
  context.write(key,value3);
  </code></pre>
  
  <p>Is there any way I can do it in the same program rather than writing three different programs?</p>
  
  <p>EDIT:</p>
  
  <p>Let me provide a much more clearer example. I need to do something like below. </p>
  
  <pre><code>A uppercase 1 firstnumber  1.0 floatnumber str stringchecking
  A uppercase 2 secondnumber 2.0 floatnumber ing stringchecking
  </code></pre>
  
  <p>My final output would be,</p>
  
  <pre><code>A 3 3.0 string
  </code></pre>
  
  <p>3 is the sum of two integers, 3.0 being sum of float numbers and string is the concatenation of two strings. </p>