Search in sources :

Example 86 with RowPagesBuilder

use of io.prestosql.RowPagesBuilder in project hetu-core by openlookeng.

the class TestHashSemiJoinOperator method testMemoryLimit.

@Test(dataProvider = "hashEnabledValues", expectedExceptions = ExceededMemoryLimitException.class, expectedExceptionsMessageRegExp = "Query exceeded per-node user memory limit of.*")
public void testMemoryLimit(boolean hashEnabled) {
    DriverContext driverContext = createTaskContext(executor, scheduledExecutor, TEST_SESSION, new DataSize(100, BYTE)).addPipelineContext(0, true, true, false).addDriverContext();
    OperatorContext operatorContext = driverContext.addOperatorContext(0, new PlanNodeId("test"), ValuesOperator.class.getSimpleName());
    List<Type> buildTypes = ImmutableList.of(BIGINT);
    RowPagesBuilder rowPagesBuilder = rowPagesBuilder(hashEnabled, Ints.asList(0), buildTypes);
    Operator buildOperator = createValuesOperator(operatorContext, rowPagesBuilder.addSequencePage(10000, 20).build());
    SetBuilderOperatorFactory setBuilderOperatorFactory = new SetBuilderOperatorFactory(1, new PlanNodeId("test"), buildTypes.get(0), 0, rowPagesBuilder.getHashChannel(), 10, new JoinCompiler(createTestMetadataManager()));
    Operator setBuilderOperator = setBuilderOperatorFactory.createOperator(driverContext);
    Driver driver = Driver.createDriver(driverContext, buildOperator, setBuilderOperator);
    while (!driver.isFinished()) {
        driver.process();
    }
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) JoinCompiler(io.prestosql.sql.gen.JoinCompiler) Type(io.prestosql.spi.type.Type) RowPagesBuilder(io.prestosql.RowPagesBuilder) DataSize(io.airlift.units.DataSize) SetBuilderOperatorFactory(io.prestosql.operator.SetBuilderOperator.SetBuilderOperatorFactory) Test(org.testng.annotations.Test)

Example 87 with RowPagesBuilder

use of io.prestosql.RowPagesBuilder in project hetu-core by openlookeng.

the class TestDistinctLimitOperator method testDistinctLimitSnapshot.

@Test
public void testDistinctLimitSnapshot() {
    RowPagesBuilder rowPagesBuilder = rowPagesBuilder(true, Ints.asList(0), BIGINT);
    List<Page> input = rowPagesBuilder.addSequencePage(3, 1).addSequencePage(5, 2).build();
    OperatorFactory operatorFactory = new DistinctLimitOperator.DistinctLimitOperatorFactory(0, new PlanNodeId("test"), rowPagesBuilder.getTypes(), Ints.asList(0), 5, rowPagesBuilder.getHashChannel(), joinCompiler);
    MaterializedResult expected = resultBuilder(driverContext.getSession(), BIGINT).row(1L).row(2L).row(3L).row(4L).row(5L).build();
    assertOperatorEqualsWithSimpleSelfStateComparison(operatorFactory, driverContext, input, expected, true, ImmutableList.of(1), createExpectedMapping());
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) RowPagesBuilder(io.prestosql.RowPagesBuilder) Page(io.prestosql.spi.Page) MaterializedResult(io.prestosql.testing.MaterializedResult) 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