I am trying to write a Hadoop mapping class in Scala. As a starting point, I gave a Java example from the book “Hadoop: The Ultimate Guide” and tried to port it to Scala.
The original Java class extends org.apache.hadoop.mapreduce.Mapper :
public class MaxTemperatureMapper extends Mapper<LongWritable, Text, Text, IntWritable>
and overrides the method
public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException
These methods are called and work correctly (I tested using the unit test, and then ran it using yarn).
My attempt at a Scala port:
class MaxTemperatureMapperS extends Mapper[LongWritable, Text, Text, IntWritable]
and then the method
@throws(classOf[IOException]) @throws(classOf[InterruptedException]) override def map(key: LongWritable, value: Text, context: Context): Unit = { ... }
but the Scala compiler produces an error message:
error: method map overrides nothing.
So, I thought that the two methods have the same signature in Scala and Java, but apparently I'm missing something. Can you give me a hint?