use of com.facebook.presto.operator.PartitionFunction in project presto by prestodb.
the class TestOptimizedPartitionedOutputOperator method testReplicated.
private void testReplicated(List<Type> types, List<Page> pages, DataSize maxMemory) {
TestingPartitionedOutputBuffer outputBuffer = createPartitionedOutputBuffer();
PartitionFunction partitionFunction = new LocalPartitionGenerator(new PrecomputedHashGenerator(0), PARTITION_COUNT);
OptimizedPartitionedOutputOperator operator = createOptimizedPartitionedOutputOperator(types, ImmutableList.of(0), partitionFunction, outputBuffer, OptionalInt.of(types.size() - 1), maxMemory);
for (Page page : pages) {
operator.addInput(page);
}
operator.finish();
Map<Integer, List<Page>> acutualPageLists = outputBuffer.getPages();
assertEquals(acutualPageLists.size(), PARTITION_COUNT);
Page expectedPage = mergePages(types, pages);
acutualPageLists.values().forEach(pageList -> assertPageEquals(types, mergePages(types, pageList), expectedPage));
}
Aggregations