checkState(channelSet != null, "Set has not been built yet");
checkState(outputPage == null, "Operator still has pending output");
// create the block builder for the new boolean column
// we know the exact size required for the block
BlockBuilder blockBuilder = BOOLEAN.createFixedSizeBlockBuilder(page.getPositionCount());
Block probeJoinBlock = page.getBlock(probeJoinChannel);
// update hashing strategy to use probe cursor
for (int position = 0; position < page.getPositionCount(); position++) {
if (probeJoinBlock.isNull(position)) {
blockBuilder.appendNull();
}
else {
boolean contains = channelSet.contains(position, probeJoinBlock);
if (!contains && channelSet.containsNull()) {
blockBuilder.appendNull();
}
else {
blockBuilder.appendBoolean(contains);
}
}
}
// add the new boolean column to the page
Block[] sourceBlocks = page.getBlocks();
Block[] outputBlocks = new Block[sourceBlocks.length + 1]; // +1 for the single boolean output channel
System.arraycopy(sourceBlocks, 0, outputBlocks, 0, sourceBlocks.length);
outputBlocks[sourceBlocks.length] = blockBuilder.build();
outputPage = new Page(outputBlocks);
}