I was able to successfully change the wordcount 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.
A Uppercase 1 firstnumber I romannumber a lowercase
B Uppercase 2 secondnumber II romannumber b lowercase
Currently in my map/reduce program, I am doing something like below. Here A is the key and 1 is the value.
A 1
I need my map reduce to perform something like below.
A 1 I a
I can do them in 3 different programs like below and can produce the output.
A 1
A I
A a
However, I want them to do in a single program itself. Basically, from my map function I want to do this.
context.write(key,value1);
context.write(key,value2);
context.write(key,value3);
Is there any way I can do it in the same program rather than writing three different programs?
EDIT:
Let me provide a much more clearer example. I need to do something like below.
A uppercase 1 firstnumber 1.0 floatnumber str stringchecking
A uppercase 2 secondnumber 2.0 floatnumber ing stringchecking
My final output would be,
A 3 3.0 string
3 is the sum of two integers, 3.0 being sum of float numbers and string is the concatenation of two strings.
map()
. – RiciWritable
, or use anArrayWritable
to define a value that is composed of 3 different values. – Riciint,string,string
? – Rici