0
내 매퍼 구현감속기에서 MapWritable의 순서를 유지하는 방법은 무엇입니까?
public class SimpleMapper extends Mapper<Text, Text, Text, MapWritable> {
@Override
protected void map(Text key, Text value,Context context)
throws IOException, InterruptedException {
MapWritable writable = new LinkedMapWritable();
writable.put("unique_key","one");
writable.put("another_key","two");
context.write(new Text("key"),writable);
}
}
그리고 감속기 구현은 다음과 같습니다
public class SimpleReducer extends Reducer<Text, MapWritable, NullWritable, Text> {
@Override
protected void reduce(Text key, Iterable<MapWritable> values,Context context)
throws IOException, InterruptedException {
// The map writables have to be ordered based on the "unique_key" inserted into it
}
}
내가 차 종류를 사용해야합니까? 그렇게 할 수있는 다른 방법이 있습니까?