Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Next revision Both sides next revision | ||
courses:mapreduce-tutorial:step-24 [2012/01/27 21:47] straka |
courses:mapreduce-tutorial:step-24 [2012/01/27 21:52] straka |
||
---|---|---|---|
Line 16: | Line 16: | ||
</ | </ | ||
- | Outputting (key, value) pairs is performed using the [[http:// | + | Outputting (key, value) pairs is performed using the [[http:// |
+ | |||
+ | Here is the source of the whole Hadoop job: | ||
<file java MapperOnlyHadoopJob.java> | <file java MapperOnlyHadoopJob.java> | ||
Line 52: | Line 54: | ||
} | } | ||
- | Job job = new Job(getConf(), | + | Job job = new Job(getConf(), |
- | job.setJarByClass(this.getClass()); | + | job.setJarByClass(this.getClass()); |
- | job.setMapperClass(TheMapper.class); | + | job.setMapperClass(TheMapper.class); |
- | job.setOutputKeyClass(Text.class); | + | job.setOutputKeyClass(Text.class); |
- | job.setOutputValueClass(Text.class); | + | job.setOutputValueClass(Text.class); |
- | job.setInputFormatClass(KeyValueTextInputFormat.class); | + | job.setInputFormatClass(KeyValueTextInputFormat.class); |
+ | // Output format is the default -- TextOutputFormat | ||
- | FileInputFormat.addInputPath(job, | + | FileInputFormat.addInputPath(job, |
- | FileOutputFormat.setOutputPath(job, | + | FileOutputFormat.setOutputPath(job, |
return job.waitForCompletion(true) ? 0 : 1; | return job.waitForCompletion(true) ? 0 : 1; |