title: Partition a spark dataframe based on column value?
body: <p>i have a dataframe from a sql source which looks like:</p>
  
  <pre><code>User(id: Long, fname: String, lname: String, country: String)
  
  [1, Fname1, Lname1, Belarus]
  [2, Fname2, Lname2, Belgium]
  [3, Fname3, Lname3, Austria]
  [4, Fname4, Lname4, Australia]
  </code></pre>
  
  <p>I want to partition and write this data into csv files where each partition is based on initial letter of the country, so Belarus and Belgium should be one in output file, Austria and Australia in other.</p>