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) {