flink: sortPartition(0, Order.ASCENDING ) error: "not found: value Order"

flink: sortPartition(0, Order.ASCENDING ) error: "not found: value Order"

我正在 运行 以下代码并得到 "error: not found: value Order" 我无法找出原因。我做错了什么?

版本:Flink v 0.9.1 (hadoop 1) 未使用 hadoop:本地执行 shell:scala shell

Scala-Flink> val data_avg = data_split.map{x=> ((x._1), (x._2._2/x._2._1))}.sortPartition(1, Order.ASCENDING).setParallelism(1)
<console>:16: error: not found: value Order
            val data_avg = data_split.map{x=> ((x._1), (x._2._2/x._2._1))}.sortPartition(0, Order.ASCENDING).setParallelism(1)

问题是枚举 Order 不会被 Flink 的 Scala shell 自动导入。因此,您必须手动添加以下导入。

import org.apache.flink.api.common.operators.Order