-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathMaxTempDriver.java
54 lines (40 loc) · 1.49 KB
/
MaxTempDriver.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package hadoop;
import java.io.*;
import javax.servlet.*;
import org.apache.hadoop.mapreduce.Mapper;
import org.apache.hadoop.mapreduce.Reducer;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.*;
import org.apache.hadoop.mapreduce.lib.output.*;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FSDataOutputStream;
public class MaxTempDriver {
public static void main(String[] args) throws Exception{
// TODO Auto-generated method stub
if(args.length != 2) {
String str = "Usage: MaxTemp<input path> <output path>";
System.err.println(str);
System.exit(-1);
//exit 0;
}
Job job = new Job();
job.setJarByClass(MaxTempDriver.class);
job.setJobName("Max Temprature");
//private static void print(String strings) {
// TODO Auto-generated method stub
// System.err.println(strings);
FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path(args[1]));
//setup the MepRed
job.setMapperClass(MaxTempMapper.class);
job.setReducerClass(MaxTempReducer.class);
//setup the output format
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
//exit when job finished
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}