Search in sources :

Example 16 with RowPagesBuilder

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);
}
Also used : RowPagesBuilder(io.prestosql.RowPagesBuilder) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) Test(org.testng.annotations.Test)

Example 17 with RowPagesBuilder

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));
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) MarkDistinctOperatorFactory(io.prestosql.operator.MarkDistinctOperator.MarkDistinctOperatorFactory) RowPagesBuilder(io.prestosql.RowPagesBuilder) MarkDistinctOperatorFactory(io.prestosql.operator.MarkDistinctOperator.MarkDistinctOperatorFactory) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) Test(org.testng.annotations.Test)

Example 18 with RowPagesBuilder

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());
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) MarkDistinctOperatorFactory(io.prestosql.operator.MarkDistinctOperator.MarkDistinctOperatorFactory) RowPagesBuilder(io.prestosql.RowPagesBuilder) MarkDistinctOperatorFactory(io.prestosql.operator.MarkDistinctOperator.MarkDistinctOperatorFactory) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) Test(org.testng.annotations.Test)

Example 19 with RowPagesBuilder

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);
}
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 20 with RowPagesBuilder

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);
}
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

RowPagesBuilder (io.prestosql.RowPagesBuilder)87 Test (org.testng.annotations.Test)83 Page (io.prestosql.spi.Page)74 MaterializedResult (io.prestosql.testing.MaterializedResult)69 PlanNodeId (io.prestosql.spi.plan.PlanNodeId)49 TestingTaskContext (io.prestosql.testing.TestingTaskContext)44 Type (io.prestosql.spi.type.Type)37 DataSize (io.airlift.units.DataSize)21 HashBuilderOperatorFactory (io.prestosql.operator.HashBuilderOperator.HashBuilderOperatorFactory)21 ValuesOperatorFactory (io.prestosql.operator.ValuesOperator.ValuesOperatorFactory)21 LocalExchangeSinkOperatorFactory (io.prestosql.operator.exchange.LocalExchangeSinkOperator.LocalExchangeSinkOperatorFactory)21 LocalExchangeSourceOperatorFactory (io.prestosql.operator.exchange.LocalExchangeSourceOperator.LocalExchangeSourceOperatorFactory)21 PageBufferOperatorFactory (io.prestosql.operator.index.PageBufferOperator.PageBufferOperatorFactory)21 MarkerPage (io.prestosql.spi.snapshot.MarkerPage)21 OperatorAssertion.toMaterializedResult (io.prestosql.operator.OperatorAssertion.toMaterializedResult)18 HashAggregationOperatorFactory (io.prestosql.operator.HashAggregationOperator.HashAggregationOperatorFactory)12 TaskContext (io.prestosql.operator.TaskContext)11 NestedLoopJoinOperatorFactory (io.prestosql.operator.NestedLoopJoinOperator.NestedLoopJoinOperatorFactory)10 LocalExchangeSourceOperator (io.prestosql.operator.exchange.LocalExchangeSourceOperator)9 RowPagesBuilder.rowPagesBuilder (io.prestosql.RowPagesBuilder.rowPagesBuilder)8