OutputTransactionContext txContext = HadoopDataSourceUtil.createContext(executionId, id);
OutputAttemptContext aContext = new OutputAttemptContext(
txContext.getTransactionId(),
String.valueOf(index),
txContext.getOutputId(),
new Counter());
ds.setupTransactionOutput(txContext);
ds.setupAttemptOutput(aContext);
ModelOutput<StringBuilder> output = ds.openOutput(
aContext,
SimpleDataDefinition.newInstance(StringBuilder.class, new MockFormat()),
"",
executionId,
new Counter());
try {
output.write(new StringBuilder("Hello, world!"));
} finally {
output.close();
}