ここでこの質問をするのは非常にばかげていることを私は知っています。目が悪いのか、それとも何なのか。ドライバークラスで構成したにもかかわらず、レデューサーが呼び出されない理由を理解できません。何かを見逃した正確な場所を特定するのを手伝ってください。
私のドライバークラス
public class DPDriver {
public static void main(String[] args)
throws IOException, InterruptedException, ClassNotFoundException {
Configuration config = new Configuration();
config.set("mapred.textoutputformat.seperator", "-->");
config.set("fs.file.impl", "com.debajit.assignment.WinLocalFileSystem");
String inputPath="In\\input.txt";
Path inPath=new Path(inputPath);
String outputPath = "C:\\output\\run1";
Path outPath=new Path(outputPath);
Job job = new Job(config,"Tst run");
job.setInputFormatClass(TextInputFormat.class);
job.setOutputFormatClass(TextOutputFormat.class);
job.setMapOutputKeyClass(Text.class);
job.setMapOutputValueClass(IntWritable.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
job.setMapperClass(DPMapper.class);
job.setReducerClass(DPReducer.class);
FileInputFormat.setInputPaths(job, inPath );
FileOutputFormat.setOutputPath(job, outPath);
System.out.println(job.waitForCompletion(true));
}
// enter code here
}
私のマッパークラス
package com.debajit.assignment;
public class DPMapper extends Mapper<LongWritable, Text, Text, IntWritable>{
public void map(LongWritable key, Text vals, Context context)
throws IOException, InterruptedException{
System.out.println(" MAPPER CALLED");
String valString = vals.toString();
String tokens[] = valString.split("\\s");
for(int i=0; i<tokens.length;i++){
System.out.println(" for loop "+i);
context.write(new Text(tokens[i]),new IntWritable(1));
}
}
}
私の減速クラス
package com.debajit.assignment;
import java.io.IOException;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;
public class DPReducer extends Reducer<Text, IntWritable, Text, IntWritable> {
public void reduce(Text key, Iterable<Text>vals, Context context)
throws IOException, InterruptedException{
System.out.println(" REDUCER CALLD");
int count=0;
for(Text t: vals){
System.out.println("---- Text-------"+ t.toString());
}
context.write(key, new IntWritable(count));
}
}