Error:(45, 63) Unable to find encoder for type stored in a Dataset. Primitive types (Int, String, etc) and Product types (case classes) are supported by importing spark.implicits._ Support for serializing other types will be added in future releases.
val ds = spark.read.json("F:\\BigData\\employees.json").as[Employee]
解决方法:
创建 SparkSession后引入语句:
import spark.implicits._

博客指出在使用Spark时遇到无法为Dataset中存储的类型找到编码器的错误,提示原始类型和产品类型可通过导入spark.implicits._支持,其他类型序列化支持将在未来版本添加,还给出了创建SparkSession后引入相关语句的解决方法。

被折叠的 条评论
为什么被折叠?



