I want to take a mean value of a temperature given in an input file and my Mapper and Reducer synatax seems fine to me but I am still getting the following error:
The key class of a mapper that maps text files is always LongWritable
. That is because it contains the byte offset of the current line and this could easily overflow an integer.
Basically you need to change your code to this:
public static class TempMapper extends Mapper<LongWritable, Text, IntWritable, FloatWritable>{
@Override
protected void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
//code for getting date and temperature
String temp = columns.get(3);
context.write(new IntWritable(year), new FloatWritable(Float.valueOf(temp)));
}
}