use of io.prestosql.RowPagesBuilder in project hetu-core by openlookeng.
the class TestStreamingAggregationOperator method testEmptyInput.
@Test
public void testEmptyInput() {
RowPagesBuilder rowPagesBuilder = RowPagesBuilder.rowPagesBuilder(BOOLEAN, VARCHAR, BIGINT);
List<Page> input = rowPagesBuilder.build();
MaterializedResult expected = resultBuilder(driverContext.getSession(), VARCHAR, BIGINT, BIGINT).build();
assertOperatorEquals(operatorFactory, driverContext, input, expected);
}
use of io.prestosql.RowPagesBuilder in project hetu-core by openlookeng.
the class TestMarkDistinctOperator method testMarkDistinct.
@Test(dataProvider = "hashEnabledValues")
public void testMarkDistinct(boolean hashEnabled) {
RowPagesBuilder rowPagesBuilder = rowPagesBuilder(hashEnabled, Ints.asList(0), BIGINT);
List<Page> input = rowPagesBuilder.addSequencePage(100, 0).addSequencePage(100, 0).build();
OperatorFactory operatorFactory = new MarkDistinctOperatorFactory(0, new PlanNodeId("test"), rowPagesBuilder.getTypes(), ImmutableList.of(0), rowPagesBuilder.getHashChannel(), joinCompiler);
MaterializedResult.Builder expected = resultBuilder(driverContext.getSession(), BIGINT, BOOLEAN);
for (long i = 0; i < 100; i++) {
expected.row(i, true);
expected.row(i, false);
}
OperatorAssertion.assertOperatorEqualsIgnoreOrder(operatorFactory, driverContext, input, expected.build(), hashEnabled, Optional.of(1));
}
use of io.prestosql.RowPagesBuilder in project hetu-core by openlookeng.
the class TestMarkDistinctOperator method testMarkDistinctSnapshot.
@Test
public void testMarkDistinctSnapshot() {
RowPagesBuilder rowPagesBuilder = rowPagesBuilder(true, Ints.asList(0), BIGINT);
List<Page> input = rowPagesBuilder.addSequencePage(100, 0).addSequencePage(100, 0).build();
OperatorFactory operatorFactory = new MarkDistinctOperatorFactory(0, new PlanNodeId("test"), rowPagesBuilder.getTypes(), ImmutableList.of(0), rowPagesBuilder.getHashChannel(), joinCompiler);
MaterializedResult.Builder expected = resultBuilder(driverContext.getSession(), BIGINT, BOOLEAN);
for (long i = 0; i < 100; i++) {
expected.row(i, true);
expected.row(i, false);
}
OperatorAssertion.assertOperatorEqualsIgnoreOrderWithSimpleSelfStateComparison(operatorFactory, driverContext, input, expected.build(), true, Optional.of(1), createExpectedMapping());
}
use of io.prestosql.RowPagesBuilder 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);
}
use of io.prestosql.RowPagesBuilder 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);
}
Aggregations