score:0

Accepted answer

try

var data = sc.textfile(mylist.mkstring(","))

alternatively, we can read each text file, then union the resulting rdds:

import scala.util.{try, success}

val rdds = mylist.flatmap { f =>
  try(sc.textfile(f)) match {
    case success(rdd) => some(rdd)
    case _ => none
  }
}
val rdd = sc.union(rdds)

More Query from same tag