LookupSource lookupSource = outputPagesIndex.createLookupSource(indexChannels);
// Build a page containing the keys that produced no output rows, so in future requests can skip these keys
PageBuilder missingKeysPageBuilder = new PageBuilder(missingKeysIndex.getTypes());
UnloadedIndexKeyRecordCursor unloadedKeyRecordCursor = unloadedKeysRecordSet.cursor();
while (unloadedKeyRecordCursor.advanceNextPosition()) {
Block[] blocks = unloadedKeyRecordCursor.getBlocks();
int position = unloadedKeyRecordCursor.getPosition();
if (lookupSource.getJoinPosition(position, blocks) < 0) {
for (int i = 0; i < blocks.length; i++) {
Block block = blocks[i];
Type type = unloadedKeyRecordCursor.getType(i);
type.appendTo(block, position, missingKeysPageBuilder.getBlockBuilder(i));
}
}
}
Page missingKeysPage = missingKeysPageBuilder.build();