gaurav narang
gaurav narang

Reputation: 21

How to register trait with KryoSerializer in Spark scala?

I have a trait named as Strategy and then I have multiple scala singleton objects implementing this trait. Can we register the trait Strategy with KryoSerializer?

I tried using this but it doesn't work

    val conf = new SparkConf()
      .set("spark.serializer", "org.apache.spark.serializer.KryoSerializer")
      .set("spark.kryo.registrationRequired", "true")
      .registerKryoClasses(Array(classOf[Strategy]))

Upvotes: 0

Views: 31

Answers (0)

Related Questions