Read
1 | val logs = spark.read.csv("/tmp/sousuo") |
Write
1 | df |
or coalesce:1
2
3
4
5df
.coalesce(1)
.write.format("com.databricks.spark.csv")
.option("header", "true")
.save("mydata.csv")
参考 https://stackoverflow.com/questions/31674530/write-single-csv-file-using-spark-csv