java.lang.UnsupportedOperationException: Schema for type MyClass is not supported

后端 未结 1 1489
遇见更好的自我
遇见更好的自我 2020-12-21 03:32

I am using Spark 1.5.0 and I have an issue while creating a dataframe from my rdd.

Here is the code:

case class MyC (myclass: MyClass) 

  val df = r         


        
相关标签:
1条回答
  • 2020-12-21 04:24

    Spark uses reflection to infer dataframe schema, but cannot do so for arbitrary classes. I'm not sure if I can state an answer better than the Spark docs can, and there's a section dedicated to exactly this.

    To be specific, the problem is that there are a limited number of types for which Spark can infer schema. Ints, Strings, Seqs/Arrays are all supported (as well as case classes containing elements of these types), but an arbitrary class MyClass is not.

    0 讨论(0)
提交回复
热议问题