Search in sources :

Example 1 with RankOperator

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

the class BatchExecRank 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();
    // operator needn't cache data
    // The collation for the partition-by and order-by fields is inessential here,
    // we only use the comparator to distinguish fields change.
    RankOperator operator = new RankOperator(ComparatorCodeGenerator.gen(config.getTableConfig(), "PartitionByComparator", inputType, SortUtil.getAscendingSortSpec(partitionFields)), ComparatorCodeGenerator.gen(config.getTableConfig(), "OrderByComparator", inputType, SortUtil.getAscendingSortSpec(sortFields)), rankStart, rankEnd, outputRankNumber);
    return ExecNodeUtil.createOneInputTransformation(inputTransform, createTransformationName(config), createTransformationDescription(config), SimpleOperatorFactory.of(operator), InternalTypeInfo.of((RowType) getOutputType()), inputTransform.getParallelism());
}
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) RankOperator(org.apache.flink.table.runtime.operators.sort.RankOperator)

Aggregations

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