{
checkArgument(percentileChannel != -1, "Raw input is not allowed for a final aggregation");
digests.ensureCapacity(groupIdsBlock.getGroupCount());
BlockCursor values = page.getBlock(valueChannel).cursor();
BlockCursor weights = page.getBlock(weightChannel).cursor();
BlockCursor percentiles = page.getBlock(percentileChannel).cursor();
BlockCursor masks = null;
if (maskChannel.isPresent()) {
masks = page.getBlock(maskChannel.get()).cursor();
}
BlockCursor sampleWeights = null;
if (sampleWeightChannel.isPresent()) {
sampleWeights = page.getBlock(sampleWeightChannel.get()).cursor();
}
for (int position = 0; position < groupIdsBlock.getPositionCount(); position++) {
checkState(values.advanceNextPosition());
checkState(weights.advanceNextPosition());
checkState(percentiles.advanceNextPosition());
checkState(masks == null || masks.advanceNextPosition());
checkState(sampleWeights == null || sampleWeights.advanceNextPosition());
long sampleWeight = SimpleAggregationFunction.computeSampleWeight(masks, sampleWeights);
long groupId = groupIdsBlock.getGroupId(position);
// skip null values