Unable to write spark df to csv with column headers and multiple partitions?

Options
parul
parul Registered Posts: 1 ✭✭✭✭
Writing spark df into csv along with headers repartitions the df into 1 by default. So it takes a lot of time while writing considering the dataset is large because only 1 partition is active. How do I write spark dataframe to csv in hdfs with column headers and multiple partitions, so that it runs faster?
Setup Info
    Tags
      Help me…