@Override
public Plan getPlan(String... args) throws IllegalArgumentException {
int numSubtasks = (args.length > 0 ? Integer.parseInt(args[0]) : 1);
String recordsPath = (args.length > 1 ? args[1] : "");
String output = (args.length > 2 ? args[2] : "");
FileDataSource source = new FileDataSource(CsvInputFormat.class, recordsPath);
source.setDegreeOfParallelism(numSubtasks);
CsvInputFormat.configureRecordFormat(source)
.recordDelimiter('\n')
.fieldDelimiter('|')
.field(IntValue.class, 0);
FileDataSink sink =
new FileDataSink(CsvOutputFormat.class, output);
sink.setDegreeOfParallelism(numSubtasks);
CsvOutputFormat.configureRecordFormat(sink)
.recordDelimiter('\n')
.fieldDelimiter('|')
.lenient(true)
.field(IntValue.class, 0);
sink.setGlobalOrder(new Ordering(0, IntValue.class, Order.ASCENDING), new UniformIntegerDistribution(Integer.MIN_VALUE, Integer.MAX_VALUE));
sink.setInput(source);
return new Plan(sink);
}