package cn.jecn.hadoop.mapreduce.com; import java.io.IOException; import java.util.StringTokenizer; import org.apache.hadoop.io.IntWritable; import org.apache.hadoop.io.Text; import org.apache.hadoop.mapreduce.Mapper; public class MapperClass extends Mapper<Object, Text, Text, IntWritable>{ public Text keyText=new Text("key"); public IntWritable intValue=new IntWritable(1); @Override protected void map(Object key, Text value, Context context) throws IOException, InterruptedException { //获取第一行的值 String str=value.toString(); StringTokenizer stringtokenizer=new StringTokenizer(str); while (stringtokenizer.hasMoreTokens()) { keyText.set(stringtokenizer.nextToken()); context.write(keyText, intValue); } } }


pangzhihui LV14
2024年6月12日
ningningnn LV3
2024年4月9日
ewan007 LV30
2023年11月13日
sunlzh888888 LV29
2023年9月15日
飞行家真真 LV1
2023年7月2日
2716804680 LV9
2023年3月23日
1690356080 LV38
2023年2月13日
Trickster LV9
2022年8月1日
tianqi2020 LV5
2022年5月27日
cccccc12 LV8
2022年5月19日