use of io.prestosql.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory in project hetu-core by openlookeng.
the class TestNestedLoopBuildOperator method testNestedLoopBuildSnapshot.
@Test
public void testNestedLoopBuildSnapshot() throws Exception {
TaskContext taskContext = createTaskContext();
List<Type> buildTypes = ImmutableList.of(BIGINT);
JoinBridgeManager<NestedLoopJoinBridge> nestedLoopJoinBridgeManager = new JoinBridgeManager<>(false, PipelineExecutionStrategy.UNGROUPED_EXECUTION, PipelineExecutionStrategy.UNGROUPED_EXECUTION, lifespan -> new NestedLoopJoinPagesSupplier(), buildTypes);
NestedLoopBuildOperatorFactory nestedLoopBuildOperatorFactory = new NestedLoopBuildOperatorFactory(3, new PlanNodeId("test"), nestedLoopJoinBridgeManager);
DriverContext driverContext = taskContext.addPipelineContext(0, true, true, false).addDriverContext();
NestedLoopBuildOperator nestedLoopBuildOperator = (NestedLoopBuildOperator) nestedLoopBuildOperatorFactory.createOperator(driverContext);
NestedLoopJoinBridge nestedLoopJoinBridge = nestedLoopJoinBridgeManager.getJoinBridge(Lifespan.taskWide());
assertFalse(nestedLoopJoinBridge.getPagesFuture().isDone());
// build pages
Page buildPage1 = new Page(3, createLongSequenceBlock(11, 14));
Page buildPageEmpty = new Page(0);
Page buildPage2 = new Page(3000, createLongSequenceBlock(4000, 7000));
nestedLoopBuildOperator.addInput(buildPage1);
nestedLoopBuildOperator.addInput(buildPageEmpty);
Object snapshot = nestedLoopBuildOperator.capture(driverContext.getSerde());
assertEquals(SnapshotTestUtil.toFullSnapshotMapping(snapshot), createExpectedMapping());
nestedLoopBuildOperator.addInput(buildPage2);
nestedLoopBuildOperator.restore(snapshot, driverContext.getSerde());
snapshot = nestedLoopBuildOperator.capture(driverContext.getSerde());
assertEquals(SnapshotTestUtil.toFullSnapshotMapping(snapshot), createExpectedMapping());
nestedLoopBuildOperator.addInput(buildPage2);
nestedLoopBuildOperator.finish();
assertTrue(nestedLoopJoinBridge.getPagesFuture().isDone());
List<Page> buildPages = nestedLoopJoinBridge.getPagesFuture().get().getPages();
assertPageEquals(buildTypes, buildPages.get(0), buildPage1);
assertEquals(buildPages.get(1), buildPage2);
assertEquals(buildPages.size(), 2);
}
use of io.prestosql.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory in project hetu-core by openlookeng.
the class TestNestedLoopJoinOperator method newJoinOperatorFactoryWithCompletedBuild.
private static NestedLoopJoinOperatorFactory newJoinOperatorFactoryWithCompletedBuild(TaskContext taskContext, RowPagesBuilder buildPages) {
DriverContext driverContext = taskContext.addPipelineContext(0, true, true, false).addDriverContext();
ValuesOperatorFactory valuesOperatorFactory = new ValuesOperatorFactory(0, new PlanNodeId("test"), buildPages.build());
JoinBridgeManager<NestedLoopJoinBridge> nestedLoopJoinBridgeManager = new JoinBridgeManager<>(false, PipelineExecutionStrategy.UNGROUPED_EXECUTION, PipelineExecutionStrategy.UNGROUPED_EXECUTION, lifespan -> new NestedLoopJoinPagesSupplier(), buildPages.getTypes());
NestedLoopBuildOperatorFactory nestedLoopBuildOperatorFactory = new NestedLoopBuildOperatorFactory(1, new PlanNodeId("test"), nestedLoopJoinBridgeManager);
NestedLoopJoinOperatorFactory joinOperatorFactory = new NestedLoopJoinOperatorFactory(3, new PlanNodeId("test"), nestedLoopJoinBridgeManager);
Operator valuesOperator = valuesOperatorFactory.createOperator(driverContext);
Operator nestedLoopBuildOperator = nestedLoopBuildOperatorFactory.createOperator(driverContext);
Driver driver = Driver.createDriver(driverContext, valuesOperator, nestedLoopBuildOperator);
valuesOperatorFactory.noMoreOperators();
nestedLoopBuildOperatorFactory.noMoreOperators();
while (nestedLoopBuildOperator.isBlocked().isDone()) {
driver.process();
}
return joinOperatorFactory;
}
use of io.prestosql.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory in project hetu-core by openlookeng.
the class TestNestedLoopBuildOperator method testNestedLoopBuildNoBlock.
@Test
public void testNestedLoopBuildNoBlock() throws Exception {
TaskContext taskContext = createTaskContext();
List<Type> buildTypes = ImmutableList.of();
JoinBridgeManager<NestedLoopJoinBridge> nestedLoopJoinBridgeManager = new JoinBridgeManager<>(false, PipelineExecutionStrategy.UNGROUPED_EXECUTION, PipelineExecutionStrategy.UNGROUPED_EXECUTION, lifespan -> new NestedLoopJoinPagesSupplier(), buildTypes);
NestedLoopBuildOperatorFactory nestedLoopBuildOperatorFactory = new NestedLoopBuildOperatorFactory(3, new PlanNodeId("test"), nestedLoopJoinBridgeManager);
DriverContext driverContext = taskContext.addPipelineContext(0, true, true, false).addDriverContext();
NestedLoopBuildOperator nestedLoopBuildOperator = (NestedLoopBuildOperator) nestedLoopBuildOperatorFactory.createOperator(driverContext);
NestedLoopJoinBridge nestedLoopJoinBridge = nestedLoopJoinBridgeManager.getJoinBridge(Lifespan.taskWide());
assertFalse(nestedLoopJoinBridge.getPagesFuture().isDone());
// build pages
Page buildPage1 = new Page(3);
Page buildPageEmpty = new Page(0);
Page buildPage2 = new Page(3000);
nestedLoopBuildOperator.addInput(buildPage1);
nestedLoopBuildOperator.addInput(buildPageEmpty);
nestedLoopBuildOperator.addInput(buildPage2);
nestedLoopBuildOperator.finish();
assertTrue(nestedLoopJoinBridge.getPagesFuture().isDone());
List<Page> buildPages = nestedLoopJoinBridge.getPagesFuture().get().getPages();
assertEquals(buildPages.get(0), buildPage1);
assertEquals(buildPages.get(1), buildPage2);
assertEquals(buildPages.size(), 2);
}
use of io.prestosql.operator.NestedLoopBuildOperator.NestedLoopBuildOperatorFactory in project hetu-core by openlookeng.
the class TestNestedLoopBuildOperator method testNestedLoopBuild.
@Test
public void testNestedLoopBuild() throws Exception {
TaskContext taskContext = createTaskContext();
List<Type> buildTypes = ImmutableList.of(BIGINT);
JoinBridgeManager<NestedLoopJoinBridge> nestedLoopJoinBridgeManager = new JoinBridgeManager<>(false, PipelineExecutionStrategy.UNGROUPED_EXECUTION, PipelineExecutionStrategy.UNGROUPED_EXECUTION, lifespan -> new NestedLoopJoinPagesSupplier(), buildTypes);
NestedLoopBuildOperatorFactory nestedLoopBuildOperatorFactory = new NestedLoopBuildOperatorFactory(3, new PlanNodeId("test"), nestedLoopJoinBridgeManager);
DriverContext driverContext = taskContext.addPipelineContext(0, true, true, false).addDriverContext();
NestedLoopBuildOperator nestedLoopBuildOperator = (NestedLoopBuildOperator) nestedLoopBuildOperatorFactory.createOperator(driverContext);
NestedLoopJoinBridge nestedLoopJoinBridge = nestedLoopJoinBridgeManager.getJoinBridge(Lifespan.taskWide());
assertFalse(nestedLoopJoinBridge.getPagesFuture().isDone());
// build pages
Page buildPage1 = new Page(3, createLongSequenceBlock(11, 14));
Page buildPageEmpty = new Page(0);
Page buildPage2 = new Page(3000, createLongSequenceBlock(4000, 7000));
nestedLoopBuildOperator.addInput(buildPage1);
nestedLoopBuildOperator.addInput(buildPageEmpty);
nestedLoopBuildOperator.addInput(buildPage2);
nestedLoopBuildOperator.finish();
assertTrue(nestedLoopJoinBridge.getPagesFuture().isDone());
List<Page> buildPages = nestedLoopJoinBridge.getPagesFuture().get().getPages();
assertEquals(buildPages.get(0), buildPage1);
assertEquals(buildPages.get(1), buildPage2);
assertEquals(buildPages.size(), 2);
}
Aggregations