Search in sources :

Example 1 with DevNullOperatorFactory

use of com.facebook.presto.operator.DevNullOperator.DevNullOperatorFactory in project presto by prestodb.

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(com.facebook.presto.spi.plan.PlanNodeId) TableWriterInfo(com.facebook.presto.operator.TableWriterOperator.TableWriterInfo) RowPagesBuilder(com.facebook.presto.RowPagesBuilder) DevNullOperatorFactory(com.facebook.presto.operator.DevNullOperator.DevNullOperatorFactory) Page(com.facebook.presto.common.Page) PageSinkManager(com.facebook.presto.split.PageSinkManager) Test(org.testng.annotations.Test)

Example 2 with DevNullOperatorFactory

use of com.facebook.presto.operator.DevNullOperator.DevNullOperatorFactory in project presto by prestodb.

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, VARBINARY));
}
Also used : PlanNodeId(com.facebook.presto.spi.plan.PlanNodeId) DevNullOperatorFactory(com.facebook.presto.operator.DevNullOperator.DevNullOperatorFactory) PageSinkManager(com.facebook.presto.split.PageSinkManager)

Aggregations

DevNullOperatorFactory (com.facebook.presto.operator.DevNullOperator.DevNullOperatorFactory)2 PlanNodeId (com.facebook.presto.spi.plan.PlanNodeId)2 PageSinkManager (com.facebook.presto.split.PageSinkManager)2 RowPagesBuilder (com.facebook.presto.RowPagesBuilder)1 Page (com.facebook.presto.common.Page)1 TableWriterInfo (com.facebook.presto.operator.TableWriterOperator.TableWriterInfo)1 Test (org.testng.annotations.Test)1