-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAvgLength.java
34 lines (31 loc) · 1.18 KB
/
AvgLength.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
//--------------------------//
// Hassan Shahzad
// 18i-0441
// PDC A3
//--------------------------//
import org.apache.hadoop.conf.Configuration;
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 AvgLength {
public static void main(String[] args) throws Exception {
if (args.length != 2) {
System.err.println("Usage: AvgTemperature <input path> <output path>");
System.exit(-1);
}
Configuration conf = new Configuration();
Job job = Job.getInstance(conf, "Average Temprature");
job.setJarByClass(AvgLength.class);
job.setJobName("Average Length of Comments");
FileInputFormat.addInputPath(job, new Path(args[0]));
FileOutputFormat.setOutputPath(job, new Path (args[1]));
job.setMapperClass(AvgLengthMapper.class);
job.setReducerClass(AvgLengthReducer.class);
job.setOutputKeyClass(Text.class);
job.setOutputValueClass(IntWritable.class);
System.exit(job.waitForCompletion(true) ? 0 : 1);
}
}