@@ -0,0 +1,2132 @@
+package org.myorg;%0A     %0A import java.io.IOException;%0A import java.util.*;%0A import org.apache.hadoop.fs.Path;%0A import org.apache.hadoop.conf.*;%0A import org.apache.hadoop.io.*;%0A import org.apache.hadoop.mapred.*;%0A import org.apache.hadoop.util.*;%0A     %0A     public class Server %7B%0A     %0A        public static class Map extends MapReduceBase implements Mapper%3CLongWritable, Text, Text, DoubleWritable%3E %7B%0A         %0A          public void map(LongWritable key, Text value, OutputCollector%3CText, DoubleWritable%3E output, Reporter reporter) throws IOException %7B%0A       %0A            String line = value.toString();%0A           %09String%5B%5D fields = line.split(%22 %22);%0A            String hour = fields%5B0%5D;%0A            String power = fields%5B1%5D.toString();%0A           %0A              output.collect(new Text (hour),new DoubleWritable(Double.parseDouble(power)));%0A           %0A          %7D%0A        %7D%0A     %0A        public static class Reduce extends MapReduceBase implements Reducer%3CText, DoubleWritable, Text, DoubleWritable%3E %7B%0A          public void reduce(Text key, Iterator%3CDoubleWritable%3E values, OutputCollector%3CText, DoubleWritable%3E output, Reporter reporter) throws IOException %7B%0A            double sum = 0;%0A            while (values.hasNext()) %7B%0A        sum += Double.parseDouble(values.next().toString());%0A         %09%0A        %0A            %7D%0A       %0A        output.collect(key, new DoubleWritable(sum));%0A          %7D%0A        %7D%0A     %0A        public static void main(String%5B%5D args) throws Exception %7B%0A          JobConf conf = new JobConf(Server.class);%0A          conf.setJobName(%22AVG%22);%0A     %0A          conf.setOutputKeyClass(Text.class);%0A          conf.setOutputValueClass(DoubleWritable.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          JobClient.runJob(conf);%0A        %7D%0A     %7D%0A

Create Server.java