0

Ich bekomme eine Ausnahme beim Versuch, Datensatz von s3 zu lesen. Firmenfallklasse enthält Satz mit Mitarbeiterfallklasse.Datensatz Encoder für Scala-Sammlungen

Exception in thread "main" java.lang.UnsupportedOperationException: No Encoder found for Set[com.model.company.common.Employee] 
- field (class: "scala.collection.immutable.Set", name: "employees") 
- field (class: "com.model.company.Company", name: "company") 

Ich habe versucht, mit Kryo:

implicit def myDataEncoder[T]: Encoder[Set[Employee]] = Encoders.kryo[scala.collection.immutable.Set[Employee] 

, aber es funktioniert auch nicht. Wissen Sie, wie Sie die Scala-Sammlung in einen Datensatz konvertieren?

Code:

val sqlContext = sparkSession.sqlContext 
import sqlContext.implicits._ 

val records = sparkSession.read.json(s"s3a://${config.input.fullPath}").as[Company] 
+0

können Sie den Code hinzufügen Du hast es versucht? – mrsrinivas

+0

Ist der Umfang implizit? –

+0

siehe meinen Code über – Przemek

Antwort