Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- case class A(s:String, i:Int)
- spark.read.parquet(file).as[A]
- sealed trait E
- case object A extends E
- case object B extends E
- spark.read.parquet(file).as[E]
- // java.lang.UnsupportedOperationException: No Encoder found for E
- implicit val eEncoder = new org.apache.spark.sql.Encoder[E] {
- def clsTag = ClassTag(classOf[E])
- def schema = StructType(StructField("e", IntegerType, nullable = false)::Nil)
- }
Add Comment
Please, Sign In to add comment