Verify yourself to prove that you are not a ROBOT! After verification the page will apear. Thanks for understanding.
I have a text file containing several records like:
I want to add a string (ex. "record:") in front of each record, so each of them will be like:
I have the code that reads this text file and creates a RDD for this file:
val aRdd = sc.textFile("/tmp/myFile")
How do I add the string to each record in this RDD using Spark? Many Thanks.
By using RDD.map:
val rddWithRecord = sc.textFile("/tmp/myFile").map(currentWord => s"record:$currentWord")