@Override
protected void processInput(GroupByIdBlock groupIdsBlock, Block valuesBlock, Optional<Block> maskBlock, Optional<Block> sampleWeightBlock)
{
counts.ensureCapacity(groupIdsBlock.getGroupCount());
samples.ensureCapacity(groupIdsBlock.getGroupCount());
BlockCursor values = valuesBlock.cursor();
BlockCursor sampleWeights = sampleWeightBlock.get().cursor();
BlockCursor masks = null;
if (maskBlock.isPresent()) {
masks = maskBlock.get().cursor();
}
for (int position = 0; position < groupIdsBlock.getPositionCount(); position++) {
long groupId = groupIdsBlock.getGroupId(position);
checkState(masks == null || masks.advanceNextPosition(), "failed to advance mask cursor");
checkState(sampleWeights.advanceNextPosition(), "failed to advance weight cursor");
checkState(values.advanceNextPosition(), "failed to advance values cursor");
long weight = values.isNull() ? 0 : SimpleAggregationFunction.computeSampleWeight(masks, sampleWeights);
counts.add(groupId, weight);
if (weight > 0) {