title: ascending sort based on values of the reducer
body: <p>I am new to hadoop mapreduce programming paradigm, can someone tell me how can I sort based on values easily? I tried implementing another comparator class, but is there a simpler way like through job config to sort based on values of the reducer. Basically i am reading log files and i want to order url to hitcount in ascending order. </p>
  
  <pre><code>public static class TokenizerMapper extends Mapper&lt;Object, Text, Text, IntWritable&gt; {
  
  private final static IntWritable ONE = new IntWritable(1);
  private Text word = new Text();
  
  public void map(Object key, Text value, Context context
                  ) throws IOException, InterruptedException {
      String[] split = value.toString().split(" ");
      for(int i=0; i&lt;split.length; i++){
          if (i==6)
              word.set(split[i]);
              context.write(word, ONE);
      }
  }
  }
  
  public static class IntSumReducer extends Reducer&lt;Text,IntWritable,Text,IntWritable&gt; {       
  private IntWritable result = new IntWritable();
  
  public void reduce(Text key, Iterable&lt;IntWritable&gt; values,  Context context) throws IOException, InterruptedException {
    int sum = 0;
    for (IntWritable val : values) {
      sum += val.get();
    }
    result.set(sum);
    context.write(key, result);      
  }
  }
  </code></pre>