我想通过配置不同的映射,与减速机的输出类型
setMapOutputKeyClass,setMapOutputValueClass,setMapKeyClass,和
setMapValueClass。但是,即使我调用了这些函数,在运行时仍会收到错误消息。
这是我的代码:
package org.myorg;
import java.io.IOException;
import java.util.*;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.*;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapred.*;
import org.apache.hadoop.util.*;
public class Sort {
public static class Map extends MapReduceBase implements Mapper<LongWritable, Text, Text, IntWritable> {
private final static IntWritable one = new IntWritable(1);
private Text word = new Text();
public void map(LongWritable key, Text value, OutputCollector<Text, IntWritable> output, Reporter reporter) throws IOException {
String line = value.toString();
StringTokenizer tokenizer = new StringTokenizer(line);
while …Run Code Online (Sandbox Code Playgroud)