I have a Datastructure that is recursive. Spark gives this error:
Exception in thread "main" java.lang.UnsupportedOperationException: cannot have circular references in class, but got the circular reference of class BulletPoint
As an example I did this code:
case class BulletPoint(item: String, children: List[BulletPoint])
object TestApp extends App {
val sparkSession = SparkSession
.builder()
.appName("spark app")
.master(s"local")
.getOrCreate()
import sparkSession.implicits._
sparkSession.createDataset(List(BulletPoint("1", Nil), BulletPoint("2", Nil)))
}
Does someone have an idea how one can go around this issue?