public void draw(Configuration conf) throws IOException {
    List<Pair<Integer, Integer>> list = new ArrayList<Pair<Integer, Integer>>();
    SequenceFileDirIterator<IntWritable, IntWritable> iterator =
        new SequenceFileDirIterator<IntWritable, IntWritable>(
            inputPath, PathType.LIST, MultipleSequenceOutputFormat.FILTER, null, true, conf);
    while (iterator.hasNext()) {
      Pair<IntWritable, IntWritable> writablePair = iterator.next();
      Pair<Integer, Integer> pair =
          new Pair<Integer, Integer>(writablePair.getFirst().get(), writablePair.getSecond().get());
      list.add(pair);
    }
    iterator.close();
    Collections.sort(
        list,
        new Comparator<Pair<Integer, Integer>>() {
          @Override
          public int compare(Pair<Integer, Integer> o1, Pair<Integer, Integer> o2) {
            if (o1.getFirst() < o2.getFirst()) {
              return -1;
            }
            return 1;
          }
        });
    XYDataset dataSet = createDataSet(list);
    JFreeChart chart =
        ChartFactory.createXYLineChart(
            title, "", "count", dataSet, PlotOrientation.VERTICAL, true, true, false);
    XYPlot plot = (XYPlot) chart.getPlot();
    NumberAxis axis = (NumberAxis) plot.getRangeAxis();
    axis.setNumberFormatOverride(numberFormat);

    BufferedImage image = chart.createBufferedImage(WIDTH, HEIGHT);
    ImageIO.write(image, FORMAT, new File(imgFile));
  }
 private Map<Integer, Long> buildOffsets(Path input, long startIndex) throws IOException {
   Map<Integer, Long> offsets = new HashMap<Integer, Long>();
   SequenceFileDirIterator<IntWritable, LongWritable> iter =
       new SequenceFileDirIterator<IntWritable, LongWritable>(
           new Path(input + "/part*"), PathType.GLOB, null, null, true, new Configuration());
   long cusum = startIndex;
   while (iter.hasNext()) {
     Pair<IntWritable, LongWritable> e = iter.next();
     int partitionId = e.getFirst().get();
     long currentLineNum = e.getSecond().get();
     offsets.put(partitionId, cusum);
     cusum += currentLineNum;
   }
   return offsets;
 }