Spark SQL SaveMode.Overwrite, getting java.io.FileNotFoundException and requiring 'REFRESH TABLE tableName'

后端 未结 4 721
孤独总比滥情好
孤独总比滥情好 2020-12-08 11:37

For spark sql, how should we fetch data from one folder in HDFS, do some modifications, and save the updated data to the same folder in HDFS via Overwrite save mode<

4条回答
  •  不思量自难忘°
    2020-12-08 12:11

    Why don't you just cache it after reading it. Saving it to another file directory and then moving the directory might entail some extra permissions. I also have been forcing an action as well, like a show().

    val myDF = spark.read.format("csv")
        .option("header", "false")
        .option("delimiter", ",")
        .load("/directory/tofile/")
    
    
    myDF.cache()
    myDF.show(2)
    

提交回复
热议问题