Search in sources :

Example 11 with NestedLoopJoinOperatorFactory

use of io.trino.operator.join.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory in project trino by trinodb.

the class TestNestedLoopJoinOperator method testCrossJoinWithNullProbe.

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

Aggregations

NestedLoopJoinOperatorFactory (io.trino.operator.join.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory)11 RowPagesBuilder (io.trino.RowPagesBuilder)10 TaskContext (io.trino.operator.TaskContext)10 Page (io.trino.spi.Page)10 MaterializedResult (io.trino.testing.MaterializedResult)10 TestingTaskContext (io.trino.testing.TestingTaskContext)10 Test (org.testng.annotations.Test)10 Type (io.trino.spi.type.Type)9 Driver (io.trino.operator.Driver)1 DriverContext (io.trino.operator.DriverContext)1 Operator (io.trino.operator.Operator)1 ValuesOperatorFactory (io.trino.operator.ValuesOperator.ValuesOperatorFactory)1 NestedLoopBuildOperatorFactory (io.trino.operator.join.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory)1 PlanNodeId (io.trino.sql.planner.plan.PlanNodeId)1