} catch (IOException e) {
throw new RuntimeException(output + ".finish() threw IOException");
}
CountersImpl totalCounters = new CountersImpl();
totalCounters.addAll(initialCounters);
totalCounters.addAll(finalCombinedResult.getCounters());
ResultAndCounters<R> result = new ResultAndCounters<R>(outputResult, totalCounters);
// HACK(ohler): It seems that pipeline doesn't always allow a promise to
// be filled in the job that created the promise. We attempt that in the
// case where there are 0 shards, like in one of our test cases. Or maybe
// it's our lack of retries on NoSuchObjectException. Need to investigate