{
checkArgument(percentileChannel != -1, "Raw input is not allowed for a final aggregation");
digests.ensureCapacity(groupIdsBlock.getGroupCount());
Block values = page.getBlock(valueChannel);
Block weights = page.getBlock(weightChannel);
Block percentiles = page.getBlock(percentileChannel);
Block masks = null;
if (maskChannel.isPresent()) {
masks = page.getBlock(maskChannel.get());
}
for (int position = 0; position < groupIdsBlock.getPositionCount(); position++) {
long groupId = groupIdsBlock.getGroupId(position);
// skip null values
if (!values.isNull(position) && !weights.isNull(position) && (masks == null || masks.getBoolean(position))) {
DigestAndPercentile currentValue = digests.get(groupId);
if (currentValue == null) {
currentValue = new DigestAndPercentile(new QuantileDigest(0.01));
digests.set(groupId, currentValue);
sizeOfValues += currentValue.getDigest().estimatedInMemorySizeInBytes();