Write Spark dataframe as CSV with partitions
Spark 2.0.0+: Built-in csv format supports partitioning out of the box so you should be able to simply use: df.write.partitionBy(‘partition_date’).mode(mode).format(“csv”).save(path) without including any additional packages. Spark < 2.0.0: At this moment (v1.4.0) spark-csv doesn’t support partitionBy (see databricks/spark-csv#123) but you can adjust built-in sources to achieve what you want. You can try two different approaches. … Read more