比如s3路径是拼凑的,那么我们从s3读数据时,很可能需要先判断路径存不存在。
var s3Path_Base = "s3n://<bucektname>/"
var s3Path = "s3n://<bucektname>/<tablename>/<partitionnumber>/"
if (FileSystem.get(new URI(s3Path_Base), sc.hadoopConfiguration).exists(new Path(s3Path)))
{
println(s"file exists, s3Path is ${s3Path}")
}
else
{
println(s"no such file ${s3Path}")
}


