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