I am new in Spark Framework and need some advice.
I have such structure of folders.
reports
- 20180101
- 20180102
- 20180103
- GHWEI.csv
- DSFSD.csv
- GHWEI.csv
Reports (csv files) are stored each day separately. For example 20180103
folder collect all reports of third january of 2018.
Before read of csv files I need to check availability of the path. How to make it?
val reports = spark.read.option("delimiter", "|")
.csv("/reports/{20180101,20180102,20180103,}/*GHWEI*")
.orderBy("CREATE_DATE")
Right now if there are no folder with name 20180101
, 20180102
, 20180103
Spark raise error which say that no such path. Code works only if one of these folders are available.
The second question is how to check is reports value is empty or not after read?