Based on your code:
sparkContext.addFile("/home/files/data.txt");
List file =sparkContext.textFile(SparkFiles.get("data.txt")).collect();
I’m assuming the file in “/home/files/data.txt” exists and is readable in the
driver’s filesystem.
Did you try just doing this:
List file =sparkContext.textF
My understanding of the model is that you’re supposed to execute
SparkFiles.get(…) on each worker node, not on the driver.
Since you already know where the files are on the driver, if you want to load
these into an RDD with SparkContext.textFile, then this will distribute it out
to the workers,