I'm using spark on google cloud platform.
Apparently I'm reading a file from the filesystem gs://<bucket>/dir/file
, but the log output prompts
FileNotFoundException: `gs:/bucket/dir/file (No such file or dir exist)
The missing /
is obviously the problem. How can I solve this?
This is my code:
val files = Array(("call 1","gs://<bucket>/google-cloud-dataproc-metainfo/test/123.wav"))
val splitAudioFiles = sc.parallelize(files.map(x => splitAudio(x, 5, sc)))
def splitAudio(path: (String, String), interval: Int, sc: SparkContext): (String, Seq[(String,Int)]) = {
val stopWords = sc.broadcast(loadTxtAsSet("gs://<bucket>/google-cloud-dataproc-metainfo/test/stopword.txt")).value
val keyWords = sc.broadcast(loadTxtAsSet("gs://<bucket>/google-cloud-dataproc-metainfo/test/KeywordList.txt")).value
val file = new File((path._2))
val audioTitle = path._1
val fileFormat: AudioFileFormat = AudioSystem.getAudioFileFormat(file)
val format = fileFormat.getFormat