How to perform one operation on each executor once in spark
You have two options: 1. Create a singleton object with a lazy val representing the data: object WekaModel { lazy val data = { // initialize data here. This will only happen once per JVM process } } Then, you can use the lazy val in your map function. The lazy val ensures that each … Read more