use of com.facebook.presto.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory in project presto by prestodb.
the class TestNestedLoopBuildOperator method testNestedLoopBuildNoBlock.
@Test
public void testNestedLoopBuildNoBlock() throws Exception {
TaskContext taskContext = createTaskContext();
NestedLoopBuildOperatorFactory nestedLoopBuildOperatorFactory = new NestedLoopBuildOperatorFactory(3, new PlanNodeId("test"), ImmutableList.of());
DriverContext driverContext = taskContext.addPipelineContext(0, true, true).addDriverContext();
NestedLoopBuildOperator nestedLoopBuildOperator = (NestedLoopBuildOperator) nestedLoopBuildOperatorFactory.createOperator(driverContext);
NestedLoopJoinPagesSupplier nestedLoopJoinPagesSupplier = nestedLoopBuildOperatorFactory.getNestedLoopJoinPagesSupplier();
assertFalse(nestedLoopJoinPagesSupplier.getPagesFuture().isDone());
// build pages
Page buildPage1 = new Page(3);
Page buildPageEmpty = new Page(0);
Page buildPage2 = new Page(3000);
nestedLoopBuildOperator.addInput(buildPage1);
nestedLoopBuildOperator.addInput(buildPageEmpty);
nestedLoopBuildOperator.addInput(buildPage2);
nestedLoopBuildOperator.finish();
assertTrue(nestedLoopJoinPagesSupplier.getPagesFuture().isDone());
List<Page> buildPages = nestedLoopJoinPagesSupplier.getPagesFuture().get().getPages();
assertEquals(buildPages.get(0), buildPage1);
assertEquals(buildPages.get(1), buildPage2);
assertEquals(buildPages.size(), 2);
}
use of com.facebook.presto.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory in project presto by prestodb.
the class TestNestedLoopBuildOperator method testNestedLoopBuild.
@Test
public void testNestedLoopBuild() throws Exception {
TaskContext taskContext = createTaskContext();
NestedLoopBuildOperatorFactory nestedLoopBuildOperatorFactory = new NestedLoopBuildOperatorFactory(3, new PlanNodeId("test"), ImmutableList.of(BIGINT));
DriverContext driverContext = taskContext.addPipelineContext(0, true, true).addDriverContext();
NestedLoopBuildOperator nestedLoopBuildOperator = (NestedLoopBuildOperator) nestedLoopBuildOperatorFactory.createOperator(driverContext);
NestedLoopJoinPagesSupplier nestedLoopJoinPagesSupplier = nestedLoopBuildOperatorFactory.getNestedLoopJoinPagesSupplier();
assertFalse(nestedLoopJoinPagesSupplier.getPagesFuture().isDone());
// build pages
Page buildPage1 = new Page(3, createLongSequenceBlock(11, 14));
Page buildPageEmpty = new Page(0);
Page buildPage2 = new Page(3000, createLongSequenceBlock(4000, 7000));
nestedLoopBuildOperator.addInput(buildPage1);
nestedLoopBuildOperator.addInput(buildPageEmpty);
nestedLoopBuildOperator.addInput(buildPage2);
nestedLoopBuildOperator.finish();
assertTrue(nestedLoopJoinPagesSupplier.getPagesFuture().isDone());
List<Page> buildPages = nestedLoopJoinPagesSupplier.getPagesFuture().get().getPages();
assertEquals(buildPages.get(0), buildPage1);
assertEquals(buildPages.get(1), buildPage2);
assertEquals(buildPages.size(), 2);
}
use of com.facebook.presto.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory in project presto by prestodb.
the class TestNestedLoopJoinOperator method buildPageSource.
private static NestedLoopJoinPagesSupplier buildPageSource(TaskContext taskContext, RowPagesBuilder buildPages) {
DriverContext driverContext = taskContext.addPipelineContext(0, true, true).addDriverContext();
ValuesOperatorFactory valuesOperatorFactory = new ValuesOperatorFactory(0, new PlanNodeId("test"), buildPages.getTypes(), buildPages.build());
NestedLoopBuildOperatorFactory nestedLoopBuildOperatorFactory = new NestedLoopBuildOperatorFactory(1, new PlanNodeId("test"), buildPages.getTypes());
Driver driver = new Driver(driverContext, valuesOperatorFactory.createOperator(driverContext), nestedLoopBuildOperatorFactory.createOperator(driverContext));
valuesOperatorFactory.close();
nestedLoopBuildOperatorFactory.close();
while (!driver.isFinished()) {
driver.process();
}
return nestedLoopBuildOperatorFactory.getNestedLoopJoinPagesSupplier();
}
Aggregations