.build();
ReduceOperator reduceNode = ReduceOperator.builder(new CountWords(), StringValue.class, 0)
.input(mapNode)
.name("Count Words")
.build();
FileDataSink out = new FileDataSink(new CsvOutputFormat(), OUT_FILE, reduceNode, "Word Counts");
CsvOutputFormat.configureRecordFormat(out)
.recordDelimiter('\n')
.fieldDelimiter(' ')
.lenient(true)
.field(StringValue.class, 0)
.field(IntValue.class, 1);
Ordering ordering = new Ordering(0, StringValue.class, Order.DESCENDING);
out.setGlobalOrder(ordering, new SimpleDistribution(new StringValue[] {new StringValue("N")}));
Plan p = new Plan(out, "WordCount Example");
p.setDefaultParallelism(DEFAULT_PARALLELISM);
OptimizedPlan plan;