protected void cleanup(Context context) throws IOException, InterruptedException { key.set(CustomKey.PARTITION_SET); for (int c = 0; c < offset.length - 1; c++) { if (offset[c] > 0) { value.setOffset(offset[c]); value.setPartition(c + 1); context.write(key, value); } offset[c + 1] += offset[c]; } }
protected void map(LongWritable ignored, Text data, Context context) throws IOException, InterruptedException { value.setValue(data); context.write(key, value); offset[CustomPartitioner.getPartition(value, parallelism)]++; }