How to create a custom Encoder in Spark 2.X Datasets?

后端 未结 3 1503
心在旅途
心在旅途 2021-02-01 06:08

Spark Datasets move away from Row\'s to Encoder\'s for Pojo\'s/primitives. The Catalyst engine uses an ExpressionEncoder to convert column

3条回答
  •  闹比i
    闹比i (楼主)
    2021-02-01 06:46

    I imported spark.implicits._ Where spark is the SparkSession and it solved the error and custom encoders got imported.

    Also, writing a custom encoder is a way out which I've not tried.

    Working solution:- Create SparkSession and import the following

    import spark.implicits._

提交回复
热议问题