运行flink的word count提示: could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation
写了一个flink简单word count的例子:
import org.apache.flink.api.scala._
object FlinkWordCount {
def main(args: Array[String]): Unit = {
val env = ExecutionEnvironment.getExecutionEnvironment
val words = List("hello", "world", "flink", "scala", "hello", "flink")
// 为DataStream和DataSet的上下文提供隐式的类型信息
implicit val typeInfo = createTypeInformation[WordCount]
val wordDataSet = env.fromCollection(words)
val wordCountDataSet = wordDataSet
.map(word => WordCount(word, 1))
.groupBy(0)
.sum(1)
}
case class WordCount(word: String, count: Int)
}
提示could not find implicit value for evidence parameter of type org.apache.flink.api.common.typeinfo.TypeInformation
各种修改后还是报错,后来想到scala版本问题。
Flink 1.10.0以上版本需要Scala 2.12.x,如果使用Scala 2.11.x版本,就会报错。请确认一下你的Scala版本是否为2.12.x,如果不是请升级Scala版本到2.12.x后再运行代码。