use of io.trino.operator.WorkProcessor.Transformation in project trino by trinodb.
the class TestWorkProcessorPipelineSourceOperator method testMergePages.
@Test
public void testMergePages() {
Transformation<Split, Page> sourceOperatorPages = split -> TransformationState.ofResult(createPage(1), false);
Transformation<Page, Page> firstOperatorPages = page -> TransformationState.ofResult(getOnlyElement(rowPagesBuilder(BIGINT).addSequencePage(1, 0).build()));
TestWorkProcessorSourceOperatorFactory sourceOperatorFactory = new TestWorkProcessorSourceOperatorFactory(1, new PlanNodeId("1"), sourceOperatorPages);
TestWorkProcessorOperatorFactory firstOperatorFactory = new TestWorkProcessorOperatorFactory(2, firstOperatorPages);
SourceOperatorFactory pipelineOperatorFactory = (SourceOperatorFactory) getOnlyElement(WorkProcessorPipelineSourceOperator.convertOperators(ImmutableList.of(new OperatorFactoryWithTypes(sourceOperatorFactory, ImmutableList.of(BIGINT)), new OperatorFactoryWithTypes(firstOperatorFactory, ImmutableList.of(BIGINT))), DataSize.ofBytes(100), 100));
DriverContext driverContext = TestingOperatorContext.create(scheduledExecutor).getDriverContext();
SourceOperator pipelineOperator = pipelineOperatorFactory.createOperator(driverContext);
pipelineOperator.addSplit(createSplit());
assertTrue(pipelineOperator.getOutput().getPositionCount() > 100);
}
Aggregations