use of org.apache.flink.table.planner.plan.nodes.exec.processor.utils.InputOrderCalculator in project flink by apache.
the class MultipleInputNodeCreationProcessor method createBatchMultipleInputNode.
private BatchExecMultipleInput createBatchMultipleInputNode(MultipleInputGroup group, List<Tuple3<ExecNode<?>, InputProperty, ExecEdge>> inputs) {
// first calculate the input orders using InputPriorityConflictResolver
Set<ExecNode<?>> inputSet = new HashSet<>();
for (Tuple3<ExecNode<?>, InputProperty, ExecEdge> tuple3 : inputs) {
inputSet.add(tuple3.f0);
}
InputOrderCalculator calculator = new InputOrderCalculator(group.root.execNode, inputSet, InputProperty.DamBehavior.BLOCKING);
Map<ExecNode<?>, Integer> inputOrderMap = calculator.calculate();
// then create input rels and edges with the input orders
ExecNode<?> rootNode = group.root.execNode;
List<ExecNode<?>> inputNodes = new ArrayList<>();
List<InputProperty> inputProperties = new ArrayList<>();
List<ExecEdge> originalEdges = new ArrayList<>();
for (Tuple3<ExecNode<?>, InputProperty, ExecEdge> tuple3 : inputs) {
ExecNode<?> inputNode = tuple3.f0;
InputProperty originalInputEdge = tuple3.f1;
ExecEdge edge = tuple3.f2;
inputNodes.add(inputNode);
inputProperties.add(InputProperty.builder().requiredDistribution(originalInputEdge.getRequiredDistribution()).damBehavior(originalInputEdge.getDamBehavior()).priority(inputOrderMap.get(inputNode)).build());
originalEdges.add(edge);
}
String description = ExecNodeUtil.getMultipleInputDescription(rootNode, inputNodes, inputProperties);
BatchExecMultipleInput multipleInput = new BatchExecMultipleInput(inputProperties, rootNode, originalEdges, description);
List<ExecEdge> inputEdges = new ArrayList<>(inputNodes.size());
for (ExecNode<?> inputNode : inputNodes) {
inputEdges.add(ExecEdge.builder().source(inputNode).target(multipleInput).build());
}
multipleInput.setInputEdges(inputEdges);
return multipleInput;
}
Aggregations