@@ -0,0 +1,2524 @@
+package ch.hesso.master;%0A%0Aimport org.apache.hadoop.conf.Configuration;%0Aimport org.apache.hadoop.conf.Configured;%0Aimport org.apache.hadoop.fs.Path;%0Aimport org.apache.hadoop.io.LongWritable;%0Aimport org.apache.hadoop.mapreduce.Job;%0Aimport org.apache.hadoop.mapreduce.Mapper;%0Aimport org.apache.hadoop.mapreduce.Reducer;%0Aimport org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;%0Aimport org.apache.hadoop.mapreduce.lib.output.SequenceFileOutputFormat;%0Aimport org.apache.hadoop.mapreduce.lib.output.TextOutputFormat;%0Aimport org.apache.hadoop.util.Tool;%0Aimport org.apache.hadoop.util.ToolRunner;%0A%0Aimport ch.hesso.master.utils.StackoverflowPost;%0Aimport ch.hesso.master.utils.StackoverflowXMLInputFormat;%0A%0Apublic class StackTest extends Configured implements Tool %7B%0A%0A%09private int numReducers;%0A%09private Path inputPath;%0A%09private Path outputPath;%0A%09%0A%09/**%0A%09 * Stripes Constructor.%0A%09 * %0A%09 * @param args%0A%09 */%0A%09public StackTest(String%5B%5D args) %7B%0A%09%09if (args.length != 3) %7B%0A%09%09%09System.out.println(%22Usage: Ngram %3Cnum_reducers%3E %3Cinput_path%3E %3Coutput_path%3E%22);%0A%09%09%09System.exit(0);%0A%09%09%7D%0A%09%09%0A%09%09numReducers = Integer.parseInt(args%5B0%5D);%0A%09%09inputPath = new Path(args%5B1%5D);%0A%09%09outputPath = new Path(args%5B2%5D);%0A%09%7D%0A%09%0A%09public static class StackTestMapper extends Mapper%3CLongWritable, StackoverflowPost, LongWritable, StackoverflowPost%3E %7B%0A%09%09%0A%09%7D%0A%0A%09public static class StackTestReducer extends Reducer%3CLongWritable, StackoverflowPost, LongWritable, StackoverflowPost%3E %7B%0A%0A%09%7D%0A%0A%09public int run(String%5B%5D args) throws Exception %7B%0A%0A%09%09Configuration conf = getConf();%0A%09%09Job job = new Job(conf, %22StackTest%22);%0A%0A%09%09job.setMapperClass(StackTestMapper.class);%0A%09%09job.setReducerClass(StackTestReducer.class);%0A%0A%09%09job.setMapOutputKeyClass(LongWritable.class);%0A%09%09job.setMapOutputValueClass(StackoverflowPost.class);%0A%0A%09%09job.setOutputKeyClass(LongWritable.class);%0A%09%09job.setOutputValueClass(StackoverflowPost.class);%0A%0A%09%09StackoverflowXMLInputFormat.addInputPath(job, inputPath);%0A%09%09job.setInputFormatClass(StackoverflowXMLInputFormat.class);%0A%0A%09%09FileOutputFormat.setOutputPath(job, outputPath);%0A%09%09%0A%09%09boolean useTextOutputFormat = !false;%0A%09%09if (useTextOutputFormat) %7B%0A%09%09%09job.setOutputFormatClass(TextOutputFormat.class);%0A%09%09%7D%0A%09%09else %7B%0A%09%09%09job.setOutputFormatClass(SequenceFileOutputFormat.class);%0A%09%09%7D%0A%0A%09%09job.setNumReduceTasks(numReducers);%0A%0A%09%09job.setJarByClass(StackTest.class);%0A%09%09%0A%09%09return job.waitForCompletion(true) ? 0 : 1;%0A%09%7D%0A%0A%09public static void main(String%5B%5D args) throws Exception %7B%0A%09%09int res = ToolRunner.run(new Configuration(), new StackTest(args), args);%0A%09%09System.exit(res);%0A%09%7D%0A%7D%0A

Add a example mapreduce job using stackoverflow class