@@ -0,0 +1,1851 @@
+package com.fan.hadoop.in_action.flowcalc.flowsort;%0A%0Aimport com.fan.hadoop.in_action.flowcalc.*;%0Aimport org.apache.hadoop.conf.Configuration;%0Aimport org.apache.hadoop.fs.FileSystem;%0Aimport org.apache.hadoop.fs.Path;%0Aimport org.apache.hadoop.io.Text;%0Aimport org.apache.hadoop.mapreduce.Job;%0Aimport org.apache.hadoop.mapreduce.lib.input.FileInputFormat;%0Aimport org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;%0A%0Aimport java.io.IOException;%0A%0A/**%0A * Created by fqc on 2016/7/9.%0A */%0Apublic class FlowSortDriver %7B%0A    public static void main(String%5B%5D args) throws IOException, ClassNotFoundException, InterruptedException %7B%0A%0A%0A        Job job = null;%0A%0A        job = Job.getInstance(new Configuration());%0A%0A        job.setJarByClass(FlowSortDriver.class);%0A        job.setMapperClass(FlowSortMapper.class);%0A        job.setReducerClass(FlowSortReducer.class);%0A%0A        /*job.setMapOutputKeyClass(Text.class); %E8%BF%99%E4%B8%A4%E6%AE%B5%E5%A4%9A%E4%BD%99%0A        job.setMapOutputValueClass(IntWritable.class);*/%0A%0A%0A        //%E6%8C%87%E5%AE%9Amapper%E8%BE%93%E5%87%BA%E6%95%B0%E6%8D%AE%E7%9A%84kv%E7%B1%BB%E5%9E%8B%0A        job.setMapOutputKeyClass(FlowBean.class);%0A        job.setMapOutputValueClass(Text.class);%0A%0A        job.setOutputKeyClass(Text.class);%0A        job.setOutputValueClass(FlowBean.class);%0A%0A        Path outputPath = new Path(%22c:/flow/flowsort/output%22);%0A        FileSystem fs = FileSystem.get(new Configuration());%0A        if (fs.exists(outputPath)) %7B%0A            fs.delete(outputPath, true);%0A        %7D%0A%0A        FileInputFormat.setInputPaths(job, %22c:/flow/flowsort/%22);%0A        FileOutputFormat.setOutputPath(job, new Path(%22c:/flow/flowsort/output%22));%0A       /* FileInputFormat.setInputPaths(job, new Path(args%5B0%5D));//addInputPaths(job,string)%EF%BC%8C%E4%BD%86%E4%B8%A4%E8%80%85%E9%83%BD%E5%8F%AF%E4%BB%A5%E6%8C%87%E5%AE%9A%E5%A4%9A%E4%B8%AA%E8%BE%93%E5%85%A5%E8%B7%AF%E5%BE%84%0A        FileOutputFormat.setOutputPath(job, new Path(args%5B1%5D));%0A*/%0A        boolean res = job.waitForCompletion(true);%0A        //int a = 1/0; %E4%B8%BA%E4%BA%86%E6%B5%8B%E8%AF%95exit 1%0A        System.exit(res ? 0 : 1);%0A    %7D%0A%7D%0A

纠正之前的错误，将mapper的输出设置 需要明确指定，前提是与reducer的输出不同的情况下。否则可以不设定