Hadoop

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

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

  • 错误描述
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())
  • 错误分析(摘自官网)
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 隐式包:

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

如果是有限的数据集(如静态文件数据集),可以导入以下 implicit 隐式包:

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

留言

您的电子邮箱地址不会被公开。