package Sort;
import java.io.IOException;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
public class sortmapper extends Mapper<LongWritable,Text,Text,DoubleWritable> {
public void map(Text key, Iterable<DoubleWritable> value, Context context) throws IOException, InterruptedException {
String line = value.toString();
String subId = line.substring(15, 26);
Double bytes = Double.parseDouble(line.substring(45, 56));
if (bytes == null)
bytes = 0.0;
context.write(new Text(subId),new DoubleWritable(bytes));
}
}
这是我写的mapper方法,但是我得到了上面的错误。
1条答案
按热度按时间a9wyjsp71#
问题在于:
LongWritable and Text
Text and DoubleWritable
public void map(LongWritable key, Text value, Context context)