You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-zh@flink.apache.org by bigdata <11...@qq.com> on 2021/01/18 07:55:42 UTC

flink1.10.1 merge参数不支持scala的迭代器吗?这算是flink的bug吗

你好:
org.apache.flink.table.planner.codegen.CodeGenException: No matching merge method found for AggregateFunction com.autoai.cns.udaf.PercentileUDAF'问题原因已找到:merge我是用的scala的迭代器,经过和官网对照后改成java的迭代器就可以了。
&nbsp; &nbsp; 我想补充下,flink1.10.1 merge参数不支持scala的迭代器吗?这算是flink的bug吗
修改后代码如下:
def merge(accumulator: ListBuffer[Float], its: java.lang.Iterable[ListBuffer[Float]]): Unit = {
//    its.forEach(i =&gt; accumulator ++ i)
    val iter = its.iterator()
    while (iter.hasNext) {
      val a = iter.next()
      accumulator ++ a
    }
  }