@@ -0,0 +1,2763 @@
+package practice;%0A%0Aimport java.io.IOException;%0Aimport java.util.*;%0A%0Aimport org.apache.hadoop.fs.Path;%0Aimport org.apache.hadoop.conf.*;%0Aimport org.apache.hadoop.io.*;%0Aimport org.apache.hadoop.mapreduce.*;%0Aimport org.apache.hadoop.mapreduce.lib.*;%0Aimport org.apache.hadoop.mapreduce.lib.input.*;%0Aimport org.apache.hadoop.mapreduce.lib.output.*;%0Aimport org.apache.hadoop.util.*;%0A%0Apublic class WordCount %7B%0A%0A  public static class Map extends MapReduceBase implements Mapper%3CLongWritable, Text, Context%3E %7B%0A    private final static IntWritable one = new IntWritable(1);%0A    private Text word = new Text();%0A%0A    public void map(LongWritable key, Text value, Context context) throws IOException, InterruptedException %7B%0A      String line = value.toString();%0A      StringTokenizer tokenizer = new StringTokenizer(line);%0A      while (tokenizer.hasMoreTokens()) %7B%0A        word.set(tokenizer.nextToken());%0A        context.write(word, one);%0A      %7D%0A    %7D%0A  %7D%0A%0Apublic static class Map1 extends MapResduceBase implements Mapper%3C Text, LongWritable, Context %3E %7B%0A%0A   %0A    public void map (Text word, LongWritable count, Context context) throws IOException, InterruptedException %7B%0A        String uppercaseString = word.toString().toUpperCase();%0A        word.set(uppercaseString);%0A        context.write(word, count);%0A    %7D%0A%7D%0A%0A  public static class Reduce extends MapReduceBase implements Reducer%3CText, IntWritable, Text, IntWritable%3E %7B%0A    public void reduce(Text key, Iterator%3CIntWritable%3E values, Context context) throws IOException, InterruptedException %7B%0A      int sum = 0;%0A      while (values.hasNext()) %7B%0A        sum += values.next().get();%0A      %7D%0A      output.collect(key, new IntWritable(sum));%0A    %7D%0A  %7D%0A%0A  public static void main(String%5B%5D args) throws Exception %7B%0A    JobConf conf = new JobConf(WordCount.class);%0A    conf.setJobName(%22wordcount%22);%0A%0A    conf.setOutputKeyClass(Text.class);%0A    conf.setOutputValueClass(IntWritable.class);%0A%0A    conf.setMapperClass(Map.class);%0A    conf.setCombinerClass(Reduce.class);%0A    conf.setReducerClass(Reduce.class);%0A%0A    conf.setInputFormat(TextInputFormat.class);%0A    conf.setOutputFormat(TextOutputFormat.class);%0A%0A    FileInputFormat.setInputPaths(conf, new Path(args%5B0%5D));%0A    FileOutputFormat.setOutputPath(conf, new Path(args%5B1%5D));%0A%0A%09Configuration mapConfig = new Configuration(false);%0A        ChainMapper.addMapper(conf, Map.class,%0A                LongWritable.class, Text.class,%0A                Text.class, LongWritable.class,%0A                mapConfig);%0A%0A        Configuration map1Config = new Configuration(false);%0A        ChainMapper.addMapper(conf, Map1.class,%0A                Text.class, LongWritable.class,%0A                Text.class, LongWritable.class,%0A                map1Config);%0A   %0A JobClient.runJob(conf);%0A  %7D%0A%7D%0A%0A%0A

package practice;