Brand new to Scala, sorry for the easy question. I need to produce map reduce logic in Scala that creates key-value pairs from words in a text file. The words are the keys and the count of the words are the values.
My issue: I need all keys to be lower case
My current code:
val test = sc.textFile("cat.txt");
val flattenMap = test.flatMap(line => line.split(" "));
val mapreduce = flattenMap.map(word => (word, 1)).reduceByKey((a,b) => a+b);
My keys are mixed case and I would like them to be all lower case. Thank you.