Ejemplo n.º 1
0
 public void map(Object key, Text value, Context context)
     throws IOException, InterruptedException {
   String[] line = value.toString().split(",");
   month.set(line[2]);
   int delay = Integer.parseInt(line[20]);
   outTuple.setCount(1);
   outTuple.setMax(delay);
   outTuple.setMin(delay);
   context.write(month, outTuple);
 }
Ejemplo n.º 2
0
    public void reduce(Text key, Iterable<MinMaxCountsTuple> values, Context context)
        throws IOException, InterruptedException {
      result.setMin(Integer.MAX_VALUE);
      result.setMax(Integer.MIN_VALUE);
      result.setCount(0);
      int sum = 0;

      for (MinMaxCountsTuple val : values) {
        if (val.getMin() < result.getMin()) {
          result.setMin(val.getMin());
        }
        if (val.getMax() > result.getMax()) {
          result.setMax(val.getMax());
        }
        sum += val.getCount();
      }

      result.setCount(sum);
      context.write(key, result);
    }