Search in sources :

Example 1 with SortOperator

use of org.apache.flink.table.runtime.operators.sort.SortOperator in project flink by apache.

the class BatchExecSort method translateToPlanInternal.

@SuppressWarnings("unchecked")
@Override
protected Transformation<RowData> translateToPlanInternal(PlannerBase planner, ExecNodeConfig config) {
    ExecEdge inputEdge = getInputEdges().get(0);
    Transformation<RowData> inputTransform = (Transformation<RowData>) inputEdge.translateToPlan(planner);
    RowType inputType = (RowType) inputEdge.getOutputType();
    SortCodeGenerator codeGen = new SortCodeGenerator(config.getTableConfig(), inputType, sortSpec);
    SortOperator operator = new SortOperator(codeGen.generateNormalizedKeyComputer("BatchExecSortComputer"), codeGen.generateRecordComparator("BatchExecSortComparator"));
    long sortMemory = config.get(ExecutionConfigOptions.TABLE_EXEC_RESOURCE_SORT_MEMORY).getBytes();
    return ExecNodeUtil.createOneInputTransformation(inputTransform, createTransformationName(config), createTransformationDescription(config), SimpleOperatorFactory.of(operator), InternalTypeInfo.of((RowType) getOutputType()), inputTransform.getParallelism(), sortMemory);
}
Also used : RowData(org.apache.flink.table.data.RowData) Transformation(org.apache.flink.api.dag.Transformation) ExecEdge(org.apache.flink.table.planner.plan.nodes.exec.ExecEdge) RowType(org.apache.flink.table.types.logical.RowType) SortCodeGenerator(org.apache.flink.table.planner.codegen.sort.SortCodeGenerator) SortOperator(org.apache.flink.table.runtime.operators.sort.SortOperator)

Aggregations

Transformation (org.apache.flink.api.dag.Transformation)1 RowData (org.apache.flink.table.data.RowData)1 SortCodeGenerator (org.apache.flink.table.planner.codegen.sort.SortCodeGenerator)1 ExecEdge (org.apache.flink.table.planner.plan.nodes.exec.ExecEdge)1 SortOperator (org.apache.flink.table.runtime.operators.sort.SortOperator)1 RowType (org.apache.flink.table.types.logical.RowType)1