if (page.getPositionCount() > 0) {
partialAggregation.addInput(page);
}
}
Block partialBlock = partialAggregation.evaluateIntermediate();
Accumulator finalAggregation = function.createIntermediateAggregation(confidence);
// Test handling of empty intermediate blocks
Block emptyBlock = function.createAggregation(Optional.<Integer>absent(), Optional.<Integer>absent(), confidence, args).evaluateIntermediate();
finalAggregation.addIntermediate(emptyBlock);
finalAggregation.addIntermediate(partialBlock);
Block finalBlock = finalAggregation.evaluateFinal();
return BlockAssertions.getOnlyValue(finalBlock);
}