No Implicit Value for Evidence Parameter Error
来源:互联网 发布:经典知乎问答 编辑:程序博客网 时间:2024/05/16 21:16
错误:could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation[Int]
解决办法: import org.apache.flink.api.scala._
产生这个问题的原因:
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.
泛型方法:
def selectFirst[T](input: DataSet[(T, _)]) : DataSet[T] = { input.map { v => v._1 }}val data : DataSet[(String, Long) = ...val result = selectFirst(data)
这个泛型方法存在的问题:
selectFirst这个方法在每一次调用的时候输入参数和返回值类型可能都是不一样的,而且在定时函数时候我们无法知道类型。因此上面调用处的代码导致 an error that not enough implicit evidence is available错误。
在这个例子中,类型信息必须在调用出生成并传递给方法,Scala提供的隐式转换参数可以解决!
如下这个代码告诉Scala携带一个类型T传递给函数,这个类型信息将会在方法调用的地方产生,而不是方法的定义处!
def selectFirst[T : TypeInformation](input: DataSet[(T, _)]) : DataSet[T] = { input.map { v => v._1 }}
解决方案官网定位:https://ci.apache.org/projects/flink/flink-docs-release-1.2/dev/types_serialization.html#type-information-in-the-scala-api
(解决问题最好的方法还是定位官方最权威的资料)
0 0
- No Implicit Value for Evidence Parameter Error
- No value specified for parameter 1
- No value specified for parameter 3
- could not find implicit value for parameter extractor 问题的解决
- could not find implicit value for parameter param: org.apache.spark.AccumulatorParam
- No value was provided for the parameter ‘appIdName’ when provisioning
- java.sql.SQLException: No value specified for parameter 16
- mybatis TypeHandler java.sql.SQLException: No value specified for parameter
- No value was provided for the parameter ‘appIdName’ when provisioning
- Spring JdbcTemplate No value specified for parameter 6
- Show the implicit parameter for each instance.
- Oracle OEM 配置报错: No value was set for the parameter DBCONTROL_HTTP_PORT 解决方法
- oracle EM创建报错“No value was set for the parameter PORT”
- Spring+Hibernate中PO主键带有GeneratedValue注解时出现No value specified for parameter 7
- Caused by: java.sql.SQLException: No value specified for parameter 2
- Error:No value provided for variable{mapId}解决方法
- Error 47 "xxxxxxx"is an invalid value for the "InputManifest" parameter of the "GenerateApplicationM
- "error":400,"reason":"Bad Request","message":"No values provided for the request parameter '_action
- Maven经验分享(一)安装部署
- R语言回归篇
- 2017武汉大学华中地区程序设计邀请赛个人感悟
- R语言经典实例 11章方差分析…
- 解决linux下tomcat8上传图片other用户无法通过Nginx查看的问题
- No Implicit Value for Evidence Parameter Error
- Maven经验分享(三)编译引入本地jar
- R语言经典实例 12-13章
- windows下打包QT程序成安装包
- R常用函数知识点
- Maven经验分享(四)执行ant脚本
- 百度贴吧“神来一句”功能分析
- R语言与网站分析 第7章分类指…
- R语言与网站分析 第8章样本分…