0
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));
}
}
這是我寫映射器的方法,但我m到處上述錯誤。在鍵的類型不匹配從圖:預期org.apache.hadoop.io.Text,接收org.apache.hadoop.io.LongWritable
的可能的複製[從圖中關鍵類型不匹配:預計org.apache.hadoop.io.Text,收到org.apache.hadoop.io.LongWritable]( http://stackoverflow.com/questions/17262188/type-mismatch-in-key-from-map-expected-org-apache-hadoop-io-text-received-org) –