Search in sources :

Example 1 with NestedLoopBuildOperatorFactory

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);
}
Also used : PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) TestingTaskContext(com.facebook.presto.testing.TestingTaskContext) NestedLoopBuildOperatorFactory(com.facebook.presto.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory) Page(com.facebook.presto.spi.Page) Test(org.testng.annotations.Test)

Example 2 with NestedLoopBuildOperatorFactory

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);
}
Also used : PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) TestingTaskContext(com.facebook.presto.testing.TestingTaskContext) NestedLoopBuildOperatorFactory(com.facebook.presto.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory) Page(com.facebook.presto.spi.Page) Test(org.testng.annotations.Test)

Example 3 with NestedLoopBuildOperatorFactory

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();
}
Also used : PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) NestedLoopBuildOperatorFactory(com.facebook.presto.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory) ValuesOperatorFactory(com.facebook.presto.operator.ValuesOperator.ValuesOperatorFactory)

Aggregations

NestedLoopBuildOperatorFactory (com.facebook.presto.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory)3 PlanNodeId (com.facebook.presto.sql.planner.plan.PlanNodeId)3 Page (com.facebook.presto.spi.Page)2 TestingTaskContext (com.facebook.presto.testing.TestingTaskContext)2 Test (org.testng.annotations.Test)2 ValuesOperatorFactory (com.facebook.presto.operator.ValuesOperator.ValuesOperatorFactory)1