我创建了一个Mapper使用语法:
public class xyz extends MapReduceBase implements Mapper<LongWritable, Text, Text, Text>{
-----
public void map(LongWritable key, Text value,
OutputCollector<Text, Text> output, Reporter reporter)
--
}
Run Code Online (Sandbox Code Playgroud)
在作业中,我创建了一个Job对象:
Job job = new Job(getConf());
Run Code Online (Sandbox Code Playgroud)
对于这项工作,我无法使用以下方法添加Mapper类:
job.setMapper(xyz);
Run Code Online (Sandbox Code Playgroud)
错误信息:
The method setMapperClass(Class<? extends Mapper>) in the type Job is not applicable for the arguments (Class<InvertedIndMap1>)
Run Code Online (Sandbox Code Playgroud)
我不能使用带有extend的地图,Mapper因为我正在使用outputCollector和Reporter在mapper.
在工作中,如果我使用JobConf而不是像以下那样的工作:
JobConf conf = new JobConf(getConf());
Run Code Online (Sandbox Code Playgroud)
然后conf.setMapper(xyz)工作.
但是无法使用以下方法设置输入路径:
FileInputFormat.addInputPaths(conf,new Path(args[0]));
Run Code Online (Sandbox Code Playgroud)
错误信息:
The method addInputPaths(Job, String) …Run Code Online (Sandbox Code Playgroud)