thovex thovex - 10 months ago 94
Scala Question

Scala method toLowerCase in spark

val file = sc.textFile(filePath)

In sol1, I have created an Rdd[Array[String]] and I want to put for every array the 3rd string element in LowerCase so call the method toLowerCase which should do that but instead it transform the string in lowercase char??

Answer Source

I assume you want to convert 3rd array element to lower case

             .map(x => Array(x(4),x(5),x(1).toLowerCase))

In your code, sol2 will be the sequence of string, not the sequence of array.