sealed trait A
final case class B(b: Int) extends A
final case class C(c: String) extends A
spark.createDataset(Seq(B(1), C("c")))
// java.lang.NoClassDefFoundError: no Java class corresponding to Product with Serializable with A found
StructType(
StructField("B", StructType(StructField("b", IntegerType) :: Nil) ::
StructField("C", StructType(StructField("c", StringType) :: Nil) :: Nil
)
or flattened set:
StructType(
StructField("b", IntegerType) ::
StructField("c", StringType) :: Nil
)
might still be useful if not converting to dataset / see if frameless can be useful here
should either be:
or flattened set: