title: Persist Spark df in S3 with random hash in file name prefix
body: <p><a href="http://docs.aws.amazon.com/AmazonS3/latest/dev/request-rate-perf-considerations.html" rel="nofollow noreferrer">AWS best practices</a> for optimizing performance in Amazon S3 is using a random hashed prefix of three or four characters before or as a part of the file name.</p>
  
  <p>I want to persist a dataframe in Parquet or ORC format in S3 and I am currently using the <code>df.write()</code> method. I am looking for a way in spark to generate a random prefix for each <em>part</em> file that is written for each partition.</p>