问题遇到的现象和发生背景
hadoop只有输入没有输出
File Input Format Counters
Bytes Read=26721
问题相关代码,请勿粘贴截图
GraduateMapper
package com.mystudy.hadoopPro;
import java.io.IOException;
import java.util.regex.Pattern;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
public class GraduateMapper extends Mapper<LongWritable,Text,Text,IntWritable>{
String file_name;
@Override
protected void setup(Mapper<LongWritable,Text,Text,IntWritable>.Context context)
throws IOException, InterruptedException {
FileSplit fs = (FileSplit) context.getInputSplit();
file_name = fs.getPath().getName(); }
@Override
protected void map(LongWritable key, Text value, Mapper<LongWritable,Text,Text,IntWritable>.Context context)
throws IOException, InterruptedException {
// TODO Auto-generated method stub //super.map(key, value, context);
String[] info = value.toString().split(",");
if(file_name.contains("sq")) {
if(info.length > 5 && info[5].isEmpty()) {
context.write(new Text("商丘 未就业"), new IntWritable(1));
}else { context.write(new Text("商丘 就业"), new IntWritable(1));
}
if( info[5].contains("学") && info[6]=="是") {
context.write(new Text("商丘 成功"), new IntWritable(1));
}else { context.write(new Text("商丘 考研"), new IntWritable(1)); }
}else if(file_name.contains("ly")) {
if(info[6].contains("岗")) {
context.write(new Text("洛阳 就业"), new IntWritable(1));
}else { context.write(new Text("洛阳 未就业"), new IntWritable(1));
}
if(info.length > 6 && info[6].length()!=0 && info[6].contains("考研上岸")) {
context.write(new Text("洛阳 成功"), new IntWritable(1));
}else { context.write(new Text("洛阳 考研"), new IntWritable(1)); }}
else if(file_name.contains("cd")) {
if( info[4].isEmpty()) {
context.write(new Text("承德 未就业"), new IntWritable(1));
}else { context.write(new Text("承德 就业"), new IntWritable(1));}
}else if(file_name.contains("xc")) {
if( info[6]=="在岗" || info[6]=="实习") {
context.write(new Text("许昌 就业"), new IntWritable(1));
}else { context.write(new Text("许昌 未就业"), new IntWritable(1));
}
//
if(info[6].contains("录取") || info[7].contains("录取")) {
context.write(new Text("许昌 成功"), new IntWritable(1));
}else { context.write(new Text("许昌 考研"), new IntWritable(1)); }
} else if(file_name.contains("zz")) {
if(info[5].contains("大学") && info[5].isEmpty()) {
context.write(new Text("郑州 未就业"), new IntWritable(1));
}else { context.write(new Text("郑州 就业"), new IntWritable(1));
}
if( info[6]=="是" && info[5].contains("大学")) {
context.write(new Text("郑州 成功"), new IntWritable(1));
}else { context.write(new Text("郑州 考研"), new IntWritable(1)); }
} }}
GraduateReduce