use of org.apache.flink.table.planner.plan.nodes.physical.FlinkPhysicalRel in project flink by apache.
the class ExecNodeGraphGenerator method generate.
private ExecNode<?> generate(FlinkPhysicalRel rel) {
ExecNode<?> execNode = visitedRels.get(rel);
if (execNode != null) {
return execNode;
}
if (rel instanceof CommonIntermediateTableScan) {
throw new TableException("Intermediate RelNode can't be converted to ExecNode.");
}
List<ExecNode<?>> inputNodes = new ArrayList<>();
for (RelNode input : rel.getInputs()) {
inputNodes.add(generate((FlinkPhysicalRel) input));
}
execNode = rel.translateToExecNode();
// connects the input nodes
List<ExecEdge> inputEdges = new ArrayList<>(inputNodes.size());
for (ExecNode<?> inputNode : inputNodes) {
inputEdges.add(ExecEdge.builder().source(inputNode).target(execNode).build());
}
execNode.setInputEdges(inputEdges);
visitedRels.put(rel, execNode);
return execNode;
}
use of org.apache.flink.table.planner.plan.nodes.physical.FlinkPhysicalRel in project flink by apache.
the class MultipleInputNodeCreationProcessorTest method assertChainableSource.
private void assertChainableSource(String name, TableTestUtil util, boolean expected) {
String sql = "SELECT * FROM " + name;
Table table = util.tableEnv().sqlQuery(sql);
RelNode relNode = TableTestUtil.toRelNode(table);
FlinkPhysicalRel optimizedRel = (FlinkPhysicalRel) util.getPlanner().optimize(relNode);
ExecNodeGraphGenerator generator = new ExecNodeGraphGenerator();
ExecNodeGraph execGraph = generator.generate(Collections.singletonList(optimizedRel));
ExecNode<?> execNode = execGraph.getRootNodes().get(0);
while (!execNode.getInputEdges().isEmpty()) {
execNode = execNode.getInputEdges().get(0).getSource();
}
ProcessorContext context = new ProcessorContext(util.getPlanner());
Assert.assertEquals(expected, MultipleInputNodeCreationProcessor.isChainableSource(execNode, context));
}
Aggregations