Search in sources :

Example 1 with DevNullOperatorFactory

use of io.prestosql.operator.DevNullOperator.DevNullOperatorFactory in project hetu-core by openlookeng.

the class TestTableWriterOperator method createTableWriterOperator.

private Operator createTableWriterOperator(BlockingPageSink blockingPageSink) {
    PageSinkManager pageSinkManager = new PageSinkManager();
    pageSinkManager.addConnectorPageSinkProvider(CONNECTOR_ID, new ConstantPageSinkProvider(blockingPageSink));
    return createTableWriterOperator(pageSinkManager, new DevNullOperatorFactory(1, new PlanNodeId("test")), ImmutableList.of(BIGINT, VARBINARY));
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) DevNullOperatorFactory(io.prestosql.operator.DevNullOperator.DevNullOperatorFactory) PageSinkManager(io.prestosql.split.PageSinkManager)

Example 2 with DevNullOperatorFactory

use of io.prestosql.operator.DevNullOperator.DevNullOperatorFactory in project hetu-core by openlookeng.

the class TestTableWriterOperator method testTableWriterInfo.

@Test
public void testTableWriterInfo() {
    PageSinkManager pageSinkManager = new PageSinkManager();
    pageSinkManager.addConnectorPageSinkProvider(CONNECTOR_ID, new ConstantPageSinkProvider(new TableWriteInfoTestPageSink()));
    TableWriterOperator tableWriterOperator = (TableWriterOperator) createTableWriterOperator(pageSinkManager, new DevNullOperatorFactory(1, new PlanNodeId("test")), ImmutableList.of(BIGINT, VARBINARY));
    RowPagesBuilder rowPagesBuilder = rowPagesBuilder(BIGINT);
    for (int i = 0; i < 100; i++) {
        rowPagesBuilder.addSequencePage(100, 0);
    }
    List<Page> pages = rowPagesBuilder.build();
    long peakMemoryUsage = 0;
    long validationCpuNanos = 0;
    for (int i = 0; i < pages.size(); i++) {
        Page page = pages.get(i);
        peakMemoryUsage += page.getRetainedSizeInBytes();
        validationCpuNanos += page.getPositionCount();
        tableWriterOperator.addInput(page);
        TableWriterInfo info = tableWriterOperator.getInfo();
        assertEquals(info.getPageSinkPeakMemoryUsage(), peakMemoryUsage);
        assertEquals((long) (info.getValidationCpuTime().getValue(NANOSECONDS)), validationCpuNanos);
    }
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) TableWriterInfo(io.prestosql.operator.TableWriterOperator.TableWriterInfo) RowPagesBuilder(io.prestosql.RowPagesBuilder) DevNullOperatorFactory(io.prestosql.operator.DevNullOperator.DevNullOperatorFactory) SerializedPage(io.hetu.core.transport.execution.buffer.SerializedPage) Page(io.prestosql.spi.Page) PageSinkManager(io.prestosql.split.PageSinkManager) Test(org.testng.annotations.Test)

Aggregations

DevNullOperatorFactory (io.prestosql.operator.DevNullOperator.DevNullOperatorFactory)2 PlanNodeId (io.prestosql.spi.plan.PlanNodeId)2 PageSinkManager (io.prestosql.split.PageSinkManager)2 SerializedPage (io.hetu.core.transport.execution.buffer.SerializedPage)1 RowPagesBuilder (io.prestosql.RowPagesBuilder)1 TableWriterInfo (io.prestosql.operator.TableWriterOperator.TableWriterInfo)1 Page (io.prestosql.spi.Page)1 Test (org.testng.annotations.Test)1