User_Info:Array(“Brian McNamee (Canada) 16th October 2015”, “Claudia Stanzani 18th September 2009”, …)
Expecting Output: Array(“Brian McNamee”, “Canada”, “16th October 2015”)
Array(“Claudia Stanzani”, “”, “18th September 2009”)
How I am trying:
val pattern="(.+)\\((.+)\\)(.+)".r //pattern variable accepts all the RDDs that contain (<country>)
val default_pattern="(.+)\\s(.+)".r //default pattern variable marking the place country column column empty
val User_profiles= User_Info.map{
| case pattern(name, country, year) => (name, country, year)
| case default_pattern(name, "", year) =>(name, "", year)}
However, I receive matchError. What is the problem that I might be facing? Thank you in advance