finalReduceVertex.addDataSink("MROutput",
MROutputLegacy.createConfigBuilder(finalReduceConf, TextOutputFormat.class, outputPath)
.build());
vertices.add(finalReduceVertex);
DAG dag = DAG.create("OrderedWordCount" + dagIndex);
for (int i = 0; i < vertices.size(); ++i) {
dag.addVertex(vertices.get(i));
}
OrderedPartitionedKVEdgeConfig edgeConf1 = OrderedPartitionedKVEdgeConfig
.newBuilder(Text.class.getName(), IntWritable.class.getName(),
HashPartitioner.class.getName()).setFromConfiguration(conf)
.configureInput().useLegacyInput().done().build();
dag.addEdge(
Edge.create(dag.getVertex("initialmap"), dag.getVertex("intermediate_reducer"),
edgeConf1.createDefaultEdgeProperty()));
OrderedPartitionedKVEdgeConfig edgeConf2 = OrderedPartitionedKVEdgeConfig
.newBuilder(IntWritable.class.getName(), Text.class.getName(),
HashPartitioner.class.getName()).setFromConfiguration(conf)
.configureInput().useLegacyInput().done().build();
dag.addEdge(
Edge.create(dag.getVertex("intermediate_reducer"), dag.getVertex("finalreduce"),
edgeConf2.createDefaultEdgeProperty()));
return dag;
}