Spark Dataset : Example : Unable to generate an encoder issue

天涯浪子 提交于 2019-11-29 07:09:24
eliasah

This line is what is causing the problem :

org.apache.spark.sql.catalyst.encoders.OuterScopes.addOuterScope(this)

This means that you are adding a new outer scope to this context that can be used when instantiating an inner class during deserialization.

Inner classes are created when a case class is defined in the Spark REPL and registering the outer scope that this class was defined in allows us to create new instances on the spark executors.

In normal use (your case), you shouldn't need to call this function.

EDIT: You'll also need to move your case classes outside of the DatasetExample object.

Note:

import sqlContext.implicits._ is a scala-specific call for implicit methods available for converting common scala RDD objects into DataFrames.

More on that here.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!