Spark-shell not finding files on LFS



Hi ,
I am trying to create a RDD by data i saved on LFS (/home/sachinji84/EMP1.csv)

I did

Spark-shell --master local

val a1 = sc.textFile("/home/sachinji84/EMP1.csv")

its giving me below error

Input path does not exist: hdfs://

why it is searching on hdfs when dataset is on LFS ?


Hi @sachin_K,

Give the path like below.

val a1 = sc.textFile(“file:///home/sachinji84/EMP1.csv”)


Thanks … it worked
But i could not understand it… can you please explain a bit ?


Hi @sachin_K,
Spark supports loading files from local file system,then it requires that the files are available at the same path on all nodes in cluster.


hi @Sravan_Kumar,
As you solved my issue so I thought to check with you only.
I have few question on HDPCD spark certification environment .

  1. in Labs.ITversity showed sc.parallelize to create Rdd from local file system.
    but while certification is is the best to way to create RDD or better to copy data to HDFS and simply use sc,testFile ()



You can use either of them.