One of my close friend has been working on spark - scala for past 2 years. He is asking me to resolve these kind of scenarios. I am going through the scala documentations and blogs to start learning and at the same time to resolve these scenarios. I am feeling very hard to resolve these kind of scenarios. Since I am from different back ground.