How to convert RDD[Row] to RDD[String]

Viewed 14207

I have a DataFrame called source, a table from mysql

val source = sqlContext.read.jdbc(jdbcUrl, "source", connectionProperties)

I have converted it to rdd by

val sourceRdd = source.rdd

but its RDD[Row] I need RDD[String] to do transformations like

source.map(rec => (rec.split(",")(0).toInt, rec)), .subtractByKey(), etc..

Thank you

2 Answers
Related