我正在尝试使用CompositeInputFormat执行映射端连接。甚至不调用映射器函数。下面是两个文件。
FILE A - KEY#VALUE
1#1;1
1#1;2
1#1;3
1#1;5
2#2;2
2#2;2
3#3;2
3#3;3
5#5;2
5#5;2
FILE B - KEY#VALUE
1#1;1
1#1;1
1#1;1
1#1;1
源代码里
Path left= new Path(args[0]);
Path rigth = new Path(args[1])
String separator = "#";
Configuration config = new Configuration();
config.set("mapreduce.input.keyvaluelinerecordreader.key.value.separator", separator);
String joinExpression = CompositeInputFormat.compose("inner", KeyValueTextInputFormat.class, left, rigth);
config.set("mapreduce.join.expr", joinExpression);
Job job = Job.getInstance(config);
job.setJobName("Blah");
job.setJarByClass(Blah.class);
job.setMapperClass(PreditorasMapper.class);
job.setReducerClass(PreditorasReducer.class);
job.setInputFormatClass(CompositeInputFormat.class);
FileOutputFormat.setOutputPath(job, new Path(args[2]));
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(Text.class);
System.exit(job.waitForCompletion(true) ? 0 : 1);
怎么了?
问题出在映射器类。
我正在使用:
public void map(Text key, Text value, Context context)
代替:
public void map(Text key, TupleWritable value, Context context)