@Override
public void map(Record record, Collector<Record> out) throws Exception {
final int d1 = record.getField(2, IntValue.class).getValue();
final int d2 = record.getField(3, IntValue.class).getValue();
if (d1 > d2) {
IntValue first = record.getField(1, IntValue.class);
IntValue second = record.getField(0, IntValue.class);
record.setField(0, first);
record.setField(1, second);
}
record.setNumFields(2);
out.collect(record);