RandomAccessBlock block = channel.get(blockIndex);
for (int positionIndex = 0; positionIndex < block.getPositionCount(); positionIndex++) {
addresses.add(encodeSyntheticAddress(blockIndex, positionIndex));
}
}
LookupSource lookupSource = lookupSourceFactoryFactory.createLookupSource(addresses, ImmutableList.of(channel), operatorContext);
JoinProbeCompiler joinProbeCompiler = new JoinProbeCompiler();
JoinProbeFactory probeFactory = joinProbeCompiler.internalCompileJoinProbe(1, Ints.asList(0));
Page page = SequencePageBuilder.createSequencePage(ImmutableList.of(VARCHAR), 10, 10);
JoinProbe joinProbe = probeFactory.createJoinProbe(lookupSource, page);
// verify channel count
assertEquals(joinProbe.getChannelCount(), 1);
BlockCursor probeCursor = page.getBlock(0).cursor();
PageBuilder pageBuilder = new PageBuilder(ImmutableList.of(VARCHAR));
for (int position = 0; position < page.getPositionCount(); position++) {
assertTrue(probeCursor.advanceNextPosition());
assertTrue(joinProbe.advanceNextPosition());
joinProbe.appendTo(pageBuilder);
assertEquals(joinProbe.getCurrentJoinPosition(), lookupSource.getJoinPosition(probeCursor));
}
assertFalse(joinProbe.advanceNextPosition());
assertBlockEquals(pageBuilder.build().getBlock(0), page.getBlock(0));
}