RichGroupReduceFunction 的正确方法签名?

Correct method signature for RichGroupReduceFunction?

以下 RichGroupReduceFunction 的扩展 class,无法编译。签名似乎与界面不匹配。我看不出区别。

   class SPointReduce extends RichGroupReduceFunction[Int, Int] {
      override def reduce (
                                 values: Iterable[Int],
                                 out: Collector[Int]): Unit = {
        values.foreach {
          value: Int =>
            out.collect(value)
        }
      }
    }

编译器报告:

Error:(62, 16) method reduce overrides nothing. Note: the super classes of class SPointReduce contain the following, non final members named reduce: def reduce(x: Iterable[Nothing],x: org.apache.flink.util.Collector[Nothing]): Unit override def reduce (

您必须确保在覆盖 RichGroupReduceFunctionreduce 方法时导入 java.lang.Iterable。否则,你会得到上面提到的错误。