Search in sources :

Example 1 with NestedLoopJoinOperatorFactory

use of io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory in project hetu-core by openlookeng.

the class TestNestedLoopJoinOperator method testEmptyBuildPage.

@Test
public void testEmptyBuildPage() {
    TaskContext taskContext = createTaskContext();
    // build
    List<Type> buildTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).pageBreak();
    // probe
    List<Type> probeTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder probePages = rowPagesBuilder(probeTypes);
    List<Page> probeInput = probePages.row("A").row("B").pageBreak().build();
    NestedLoopJoinOperatorFactory joinOperatorFactory = newJoinOperatorFactoryWithCompletedBuild(taskContext, buildPages);
    // expected
    MaterializedResult expected = resultBuilder(taskContext.getSession(), concat(probeTypes, buildPages.getTypes())).build();
    assertOperatorEquals(joinOperatorFactory, taskContext.addPipelineContext(0, true, true, false).addDriverContext(), probeInput, expected);
}
Also used : Type(io.prestosql.spi.type.Type) TestingTaskContext(io.prestosql.testing.TestingTaskContext) RowPagesBuilder(io.prestosql.RowPagesBuilder) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) NestedLoopJoinOperatorFactory(io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory) Test(org.testng.annotations.Test)

Example 2 with NestedLoopJoinOperatorFactory

use of io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory in project hetu-core by openlookeng.

the class TestNestedLoopJoinOperator method newJoinOperatorFactoryWithCompletedBuild.

private static NestedLoopJoinOperatorFactory newJoinOperatorFactoryWithCompletedBuild(TaskContext taskContext, RowPagesBuilder buildPages) {
    DriverContext driverContext = taskContext.addPipelineContext(0, true, true, false).addDriverContext();
    ValuesOperatorFactory valuesOperatorFactory = new ValuesOperatorFactory(0, new PlanNodeId("test"), buildPages.build());
    JoinBridgeManager<NestedLoopJoinBridge> nestedLoopJoinBridgeManager = new JoinBridgeManager<>(false, PipelineExecutionStrategy.UNGROUPED_EXECUTION, PipelineExecutionStrategy.UNGROUPED_EXECUTION, lifespan -> new NestedLoopJoinPagesSupplier(), buildPages.getTypes());
    NestedLoopBuildOperatorFactory nestedLoopBuildOperatorFactory = new NestedLoopBuildOperatorFactory(1, new PlanNodeId("test"), nestedLoopJoinBridgeManager);
    NestedLoopJoinOperatorFactory joinOperatorFactory = new NestedLoopJoinOperatorFactory(3, new PlanNodeId("test"), nestedLoopJoinBridgeManager);
    Operator valuesOperator = valuesOperatorFactory.createOperator(driverContext);
    Operator nestedLoopBuildOperator = nestedLoopBuildOperatorFactory.createOperator(driverContext);
    Driver driver = Driver.createDriver(driverContext, valuesOperator, nestedLoopBuildOperator);
    valuesOperatorFactory.noMoreOperators();
    nestedLoopBuildOperatorFactory.noMoreOperators();
    while (nestedLoopBuildOperator.isBlocked().isDone()) {
        driver.process();
    }
    return joinOperatorFactory;
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) NestedLoopBuildOperatorFactory(io.prestosql.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory) ValuesOperatorFactory(io.prestosql.operator.ValuesOperator.ValuesOperatorFactory) NestedLoopJoinOperatorFactory(io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory)

Example 3 with NestedLoopJoinOperatorFactory

use of io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory in project hetu-core by openlookeng.

the class TestNestedLoopJoinOperator method testProbeAndBuildMultiplePages.

@Test
public void testProbeAndBuildMultiplePages() {
    TaskContext taskContext = createTaskContext();
    // build
    List<Type> buildTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("A").row("B").pageBreak().row("C");
    // probe
    List<Type> probeTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder probePages = rowPagesBuilder(probeTypes);
    List<Page> probeInput = probePages.row("a").pageBreak().row((String) null).row("b").row("c").pageBreak().row("d").build();
    NestedLoopJoinOperatorFactory joinOperatorFactory = newJoinOperatorFactoryWithCompletedBuild(taskContext, buildPages);
    // expected
    MaterializedResult expected = resultBuilder(taskContext.getSession(), concat(probeTypes, buildPages.getTypes())).row("a", "A").row("a", "B").row("a", "C").row(null, "A").row("b", "A").row("c", "A").row(null, "B").row("b", "B").row("c", "B").row(null, "C").row("b", "C").row("c", "C").row("d", "A").row("d", "B").row("d", "C").build();
    assertOperatorEquals(joinOperatorFactory, taskContext.addPipelineContext(0, true, true, false).addDriverContext(), probeInput, expected);
}
Also used : Type(io.prestosql.spi.type.Type) TestingTaskContext(io.prestosql.testing.TestingTaskContext) RowPagesBuilder(io.prestosql.RowPagesBuilder) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) NestedLoopJoinOperatorFactory(io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory) Test(org.testng.annotations.Test)

Example 4 with NestedLoopJoinOperatorFactory

use of io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory in project hetu-core by openlookeng.

the class TestNestedLoopJoinOperator method testProbeAndBuildMultiplePagesSnapshot.

@Test
public void testProbeAndBuildMultiplePagesSnapshot() {
    TaskContext taskContext = createTaskContext();
    // build
    List<Type> buildTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("A").row("B").pageBreak().row("C");
    // probe
    List<Type> probeTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder probePages = rowPagesBuilder(probeTypes);
    List<Page> probeInput = probePages.row("a").pageBreak().row((String) null).row("b").row("c").pageBreak().row("d").build();
    NestedLoopJoinOperatorFactory joinOperatorFactory = newJoinOperatorFactoryWithCompletedBuild(taskContext, buildPages);
    // expected
    MaterializedResult expected = resultBuilder(taskContext.getSession(), concat(probeTypes, buildPages.getTypes())).row("a", "A").row("a", "B").row("a", "C").row(null, "A").row("b", "A").row("c", "A").row(null, "B").row("b", "B").row("c", "B").row(null, "C").row("b", "C").row("c", "C").row("d", "A").row("d", "B").row("d", "C").build();
    assertOperatorEqualsWithSimpleSelfStateComparison(joinOperatorFactory, taskContext.addPipelineContext(0, true, true, false).addDriverContext(), probeInput, expected, createExpectedMapping());
}
Also used : Type(io.prestosql.spi.type.Type) TestingTaskContext(io.prestosql.testing.TestingTaskContext) RowPagesBuilder(io.prestosql.RowPagesBuilder) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) NestedLoopJoinOperatorFactory(io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory) Test(org.testng.annotations.Test)

Example 5 with NestedLoopJoinOperatorFactory

use of io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory in project hetu-core by openlookeng.

the class TestNestedLoopJoinOperator method testCrossJoinWithNullBuild.

@Test
public void testCrossJoinWithNullBuild() {
    TaskContext taskContext = createTaskContext();
    // build
    List<Type> buildTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("a").row((String) null).row((String) null).row("a").row("b");
    // probe
    List<Type> probeTypes = ImmutableList.of(VARCHAR);
    RowPagesBuilder probePages = rowPagesBuilder(probeTypes);
    List<Page> probeInput = probePages.row("A").row("B").build();
    NestedLoopJoinOperatorFactory joinOperatorFactory = newJoinOperatorFactoryWithCompletedBuild(taskContext, buildPages);
    // expected
    MaterializedResult expected = resultBuilder(taskContext.getSession(), concat(probeTypes, buildPages.getTypes())).row("A", "a").row("A", null).row("A", null).row("A", "a").row("A", "b").row("B", "a").row("B", null).row("B", null).row("B", "a").row("B", "b").build();
    assertOperatorEquals(joinOperatorFactory, taskContext.addPipelineContext(0, true, true, false).addDriverContext(), probeInput, expected);
}
Also used : Type(io.prestosql.spi.type.Type) TestingTaskContext(io.prestosql.testing.TestingTaskContext) RowPagesBuilder(io.prestosql.RowPagesBuilder) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) NestedLoopJoinOperatorFactory(io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory) Test(org.testng.annotations.Test)

Aggregations

NestedLoopJoinOperatorFactory (io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory)11 RowPagesBuilder (io.prestosql.RowPagesBuilder)10 Page (io.prestosql.spi.Page)10 MaterializedResult (io.prestosql.testing.MaterializedResult)10 TestingTaskContext (io.prestosql.testing.TestingTaskContext)10 Test (org.testng.annotations.Test)10 Type (io.prestosql.spi.type.Type)9 NestedLoopBuildOperatorFactory (io.prestosql.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory)1 ValuesOperatorFactory (io.prestosql.operator.ValuesOperator.ValuesOperatorFactory)1 PlanNodeId (io.prestosql.spi.plan.PlanNodeId)1