


__________MaxTemp____________

import java.io.IOException;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;


public class MaxTemp {

	public static void main(String[] args) throws IOException, ClassNotFoundException, InterruptedException {
		Job job = new Job();
		job.setJarByClass(MaxTemp.class);
		job.setJobName("MaxTemplerature");
		
		FileInputFormat.addInputPath(job, new Path(args[0]));
		FileOutputFormat.setOutputPath(job , new Path(args[1]));
		
		job.setMapperClass(MaxTempMapper.class);
		job.setReducerClass(MapTempReducer.class);
		
		job.setOutputKeyClass(Text.class);
		job.setOutputValueClass(IntWritable.class);
		
		System.out.println(job.waitForCompletion(true)?0 : 1);

	}

}


____________MapTempReducer__________


import java.io.IOException;

import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Reducer;


public class MapTempReducer extends Reducer<Text, IntWritable, Text, IntWritable> {
	int maxValue = Integer.MIN_VALUE;
	public void reduce(Text key , Iterable<IntWritable> values , Context context) throws IOException, InterruptedException
	{
		for(IntWritable tem : values)
		{
			maxValue = Math.max(maxValue, tem.get());
		}
		context.write(key,new IntWritable(maxValue));
	}

}
