Search in sources :

Example 1 with BatchExecSort

use of org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecSort in project flink by apache.

the class ForwardHashExchangeProcessor method addExchangeAndReconnectEdge.

// TODO This implementation should be updated once FLINK-21224 is finished.
private ExecEdge addExchangeAndReconnectEdge(ExecEdge edge, InputProperty inputProperty, boolean strict) {
    ExecNode<?> target = edge.getTarget();
    ExecNode<?> source = edge.getSource();
    if (source instanceof CommonExecExchange) {
        return edge;
    }
    // only Calc, Correlate and Sort can propagate sort property and distribution property
    if (source instanceof BatchExecCalc || source instanceof BatchExecPythonCalc || source instanceof BatchExecSort || source instanceof BatchExecCorrelate || source instanceof BatchExecPythonCorrelate) {
        ExecEdge newEdge = addExchangeAndReconnectEdge(source.getInputEdges().get(0), inputProperty, strict);
        source.setInputEdges(Collections.singletonList(newEdge));
    }
    BatchExecExchange exchange = createExchangeWithKeepInputAsIsDistribution(inputProperty, strict, (RowType) edge.getOutputType());
    ExecEdge newEdge = new ExecEdge(source, exchange, edge.getShuffle(), edge.getExchangeMode());
    exchange.setInputEdges(Collections.singletonList(newEdge));
    return new ExecEdge(exchange, target, edge.getShuffle(), edge.getExchangeMode());
}
Also used : CommonExecExchange(org.apache.flink.table.planner.plan.nodes.exec.common.CommonExecExchange) BatchExecSort(org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecSort) ExecEdge(org.apache.flink.table.planner.plan.nodes.exec.ExecEdge) BatchExecCalc(org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecCalc) BatchExecPythonCorrelate(org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecPythonCorrelate) BatchExecPythonCalc(org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecPythonCalc) BatchExecExchange(org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecExchange) BatchExecCorrelate(org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecCorrelate)

Aggregations

ExecEdge (org.apache.flink.table.planner.plan.nodes.exec.ExecEdge)1 BatchExecCalc (org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecCalc)1 BatchExecCorrelate (org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecCorrelate)1 BatchExecExchange (org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecExchange)1 BatchExecPythonCalc (org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecPythonCalc)1 BatchExecPythonCorrelate (org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecPythonCorrelate)1 BatchExecSort (org.apache.flink.table.planner.plan.nodes.exec.batch.BatchExecSort)1 CommonExecExchange (org.apache.flink.table.planner.plan.nodes.exec.common.CommonExecExchange)1