use of com.facebook.presto.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory in project presto by prestodb.
the class TestNestedLoopJoinOperator method testProbeMultiplePages.
@Test
public void testProbeMultiplePages() throws Exception {
TaskContext taskContext = createTaskContext();
// build
List<Type> buildTypes = ImmutableList.of(VARCHAR);
RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("A").row("B");
NestedLoopJoinPagesSupplier nestedLoopJoinPagesSupplier = buildPageSource(taskContext, buildPages);
// 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 = new NestedLoopJoinOperatorFactory(3, new PlanNodeId("test"), nestedLoopJoinPagesSupplier, ImmutableList.of(VARCHAR));
// expected
MaterializedResult expected = resultBuilder(taskContext.getSession(), concat(probeTypes, buildPages.getTypes())).row("a", "A").row("a", "B").row(null, "A").row("b", "A").row("c", "A").row(null, "B").row("b", "B").row("c", "B").row("d", "A").row("d", "B").build();
assertOperatorEquals(joinOperatorFactory, taskContext.addPipelineContext(0, true, true).addDriverContext(), probeInput, expected);
}
use of com.facebook.presto.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory in project presto by prestodb.
the class TestNestedLoopJoinOperator method testEmptyProbePage.
@Test
public void testEmptyProbePage() throws Exception {
TaskContext taskContext = createTaskContext();
// build
List<Type> buildTypes = ImmutableList.of(VARCHAR);
RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("A").row("B").pageBreak().row("C");
NestedLoopJoinPagesSupplier nestedLoopJoinPagesSupplier = buildPageSource(taskContext, buildPages);
// probe
List<Type> probeTypes = ImmutableList.of(VARCHAR);
RowPagesBuilder probePages = rowPagesBuilder(probeTypes);
List<Page> probeInput = probePages.pageBreak().build();
NestedLoopJoinOperatorFactory joinOperatorFactory = new NestedLoopJoinOperatorFactory(3, new PlanNodeId("test"), nestedLoopJoinPagesSupplier, ImmutableList.of(VARCHAR));
// expected
MaterializedResult expected = resultBuilder(taskContext.getSession(), concat(probeTypes, buildPages.getTypes())).build();
assertOperatorEquals(joinOperatorFactory, taskContext.addPipelineContext(0, true, true).addDriverContext(), probeInput, expected);
}
use of com.facebook.presto.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory in project presto by prestodb.
the class TestNestedLoopJoinOperator method testCrossJoinWithNullProbe.
@Test
public void testCrossJoinWithNullProbe() throws Exception {
TaskContext taskContext = createTaskContext();
// build
List<Type> buildTypes = ImmutableList.of(VARCHAR);
RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("a").row("b");
NestedLoopJoinPagesSupplier nestedLoopJoinPagesSupplier = buildPageSource(taskContext, buildPages);
// 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 = new NestedLoopJoinOperatorFactory(3, new PlanNodeId("test"), nestedLoopJoinPagesSupplier, ImmutableList.of(VARCHAR));
// 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).addDriverContext(), probeInput, expected);
}
use of com.facebook.presto.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory in project presto by prestodb.
the class TestNestedLoopJoinOperator method testCrossJoinWithNullBuild.
@Test
public void testCrossJoinWithNullBuild() throws Exception {
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");
NestedLoopJoinPagesSupplier nestedLoopJoinPagesSupplier = buildPageSource(taskContext, buildPages);
// probe
List<Type> probeTypes = ImmutableList.of(VARCHAR);
RowPagesBuilder probePages = rowPagesBuilder(probeTypes);
List<Page> probeInput = probePages.row("A").row("B").build();
NestedLoopJoinOperatorFactory joinOperatorFactory = new NestedLoopJoinOperatorFactory(3, new PlanNodeId("test"), nestedLoopJoinPagesSupplier, ImmutableList.of(VARCHAR));
// 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).addDriverContext(), probeInput, expected);
}
use of com.facebook.presto.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory in project presto by prestodb.
the class TestNestedLoopJoinOperator method testProbeAndBuildMultiplePages.
@Test
public void testProbeAndBuildMultiplePages() throws Exception {
TaskContext taskContext = createTaskContext();
// build
List<Type> buildTypes = ImmutableList.of(VARCHAR);
RowPagesBuilder buildPages = rowPagesBuilder(buildTypes).row("A").row("B").pageBreak().row("C");
NestedLoopJoinPagesSupplier nestedLoopJoinPagesSupplier = buildPageSource(taskContext, buildPages);
// 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 = new NestedLoopJoinOperatorFactory(3, new PlanNodeId("test"), nestedLoopJoinPagesSupplier, ImmutableList.of(VARCHAR));
// 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).addDriverContext(), probeInput, expected);
}
Aggregations