{
checkNotNull(page, "page is null");
checkState(state == State.RUNNING, "Operator is %s", state);
BlockCursor[] cursors;
BlockCursor sampleWeightCursor = null;
if (sampleWeightChannel.isPresent()) {
cursors = new BlockCursor[page.getChannelCount() - 1];
sampleWeightCursor = page.getBlock(sampleWeightChannel.get()).cursor();
}
else {
cursors = new BlockCursor[recordTypes.size()];
}
for (int outputChannel = 0; outputChannel < cursors.length; outputChannel++) {
cursors[outputChannel] = page.getBlock(inputChannels.get(outputChannel)).cursor();
}
int rows = 0;
for (int position = 0; position < page.getPositionCount(); position++) {
long sampleWeight = 1;
if (sampleWeightCursor != null) {
checkArgument(sampleWeightCursor.advanceNextPosition());
sampleWeight = sampleWeightCursor.getLong();
}
rows += sampleWeight;
recordSink.beginRecord(sampleWeight);
for (int i = 0; i < cursors.length; i++) {
checkArgument(cursors[i].advanceNextPosition());