throws Exception
{
// compile a single channel hash strategy
JoinCompiler joinCompiler = new JoinCompiler();
List<Type> types = ImmutableList.<Type>of(VARCHAR, VARCHAR, BIGINT, DOUBLE, BOOLEAN);
PagesHashStrategyFactory pagesHashStrategyFactory = joinCompiler.compilePagesHashStrategyFactory(types, Ints.asList(1, 2, 3, 4));
// crate hash strategy with a single channel blocks -- make sure there is some overlap in values
List<Block> extraChannel = ImmutableList.of(
BlockAssertions.createStringSequenceBlock(10, 20),
BlockAssertions.createStringSequenceBlock(20, 30),
BlockAssertions.createStringSequenceBlock(15, 25));
List<Block> varcharChannel = ImmutableList.of(
BlockAssertions.createStringSequenceBlock(10, 20),
BlockAssertions.createStringSequenceBlock(20, 30),
BlockAssertions.createStringSequenceBlock(15, 25));
List<Block> longChannel = ImmutableList.of(
BlockAssertions.createLongSequenceBlock(10, 20),
BlockAssertions.createLongSequenceBlock(20, 30),
BlockAssertions.createLongSequenceBlock(15, 25));
List<Block> doubleChannel = ImmutableList.of(
BlockAssertions.createDoubleSequenceBlock(10, 20),
BlockAssertions.createDoubleSequenceBlock(20, 30),
BlockAssertions.createDoubleSequenceBlock(15, 25));
List<Block> booleanChannel = ImmutableList.of(
BlockAssertions.createBooleanSequenceBlock(10, 20),
BlockAssertions.createBooleanSequenceBlock(20, 30),
BlockAssertions.createBooleanSequenceBlock(15, 25));
ImmutableList<List<Block>> channels = ImmutableList.of(extraChannel, varcharChannel, longChannel, doubleChannel, booleanChannel);
PagesHashStrategy hashStrategy = pagesHashStrategyFactory.createPagesHashStrategy(channels);
// verify channel count
assertEquals(hashStrategy.getChannelCount(), 5);
PagesHashStrategy expectedHashStrategy = new SimplePagesHashStrategy(types, channels, Ints.asList(1, 2, 3, 4));