栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 前沿技术 > 大数据 > 大数据系统

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..

错误描述:

could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation[String]

Error:(17, 15) could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation[String]
      .flatMap(_.split(" "))
Error:(17, 15) not enough arguments for method flatMap: (implicit evidence$16: org.apache.flink.api.common.typeinfo.TypeInformation[String], implicit evidence$17: scala.reflect.ClassTag[String])org.apache.flink.api.scala.DataSet[String].
Unspecified value parameters evidence$16, evidence$17.
      .flatMap(_.split(" "))

官网说明:

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.
解决方法:

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

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

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

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

如果通过以上方式问题还是没有解决,则看下Scala版本问题。自己的idea的scala版本和pom.xml中的不一致!!!

如图,点击File里面的Project Structure:

 然后看下scala版本

我的版本为 2.11.12

然后看下pom.xml文件,flink对应的scala版本也应为2.11系列。

 
 

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/758956.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号