Response to the 1st approach:
When you do spark.read.text("/xyz/a/b/filename") it returns a DataFrame and
when applying the rdd methods gives you a RDD[Row], so when you use map,
your function get Row as the parameter i.e; ip in your code. Therefore you
must use the Row methods to access its membe
1st Approach:
error : value split is not a member of org.apache.spark.sql.Row?
val newRdd = spark.read.text("/xyz/a/b/filename").rdd
anotherRDD = newRdd.
map(ip =>ip.split("\\|")).map(ip => Row(if (ip(0).isEmpty()) {
null.asInstanceOf[Int] }