flink编译报错:could not find implicit value for evidence parameter of type org.apache.flink.api.common..

版权声明:版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/lijingjingchn/article/details/87286735

1. 前言

错误描述:

Error:(33, 20) could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation[utils.CsvFormatter.UserBehavior]
    env.createInput(pair.getValue0())
Error:(26, 20) not enough arguments for method createInput: (implicit evidence$8: org.apache.flink.api.common.typeinfo.TypeInformation[utils.CsvFormatter.UserBehavior])org.apache.flink.streaming.api.scala.DataStream[utils.CsvFormatter.UserBehavior].
Unspecified value parameter evidence$8.
    env.createInput(pair.getValue0())

2. 错误原因

官网说明:

1:A frequent reason if that the code that generates the TypeInformation has not been imported. Make sure to import the entire flink.api.scala package.

2:Another common cause are generic methods, which can be fixed as described in the following section.

这种异常的发生通常是因为程序需要一个隐式参数(implicit parameter),待深入研究。

3. 解决方法

推荐的做法是在代码中引入以下包:

import org.apache.flink.streaming.api.scala._

如果数据是有限的(静态数据集),我们可以引入以下包:

import org.apache.flink.api.scala._

然后即可解决上面的异常信息。

猜你喜欢

转载自blog.csdn.net/lijingjingchn/article/details/87286735