Why is the error “Unable to find encoder for type stored in a Dataset” when encoding JSON using case classes?

前端 未结 3 1295
借酒劲吻你
借酒劲吻你 2020-12-09 04:04

I\'ve written spark job:

object SimpleApp {
  def main(args: Array[String]) {
    val conf = new SparkConf().setAppName(\"Simple Application\").setMaster(\"l         


        
3条回答
  •  死守一世寂寞
    2020-12-09 04:52

    The error message says that the Encoder is not able to take the Person case class.

    Error:(15, 67) Unable to find encoder for type stored in a Dataset.  Primitive types (Int, String, etc) and Product types (case classes) are supported by importing sqlContext.implicits._  Support for serializing other types will be added in future releases.
    

    Move the declaration of the case class outside the scope of SimpleApp.

提交回复
热议问题