title: Spark: How to modify the output directory of a local SparkSession?
body: <p>I have the following <code>SparkSession</code> which I use for testing:</p>
  
  <pre><code>  SparkSession.builder().master("local").getOrCreate()
  </code></pre>
  
  <p>Whenever I run for example a unit test that writes data, e.g., <code>df.write.csv("foobar")</code> the output directory will be in the top-level of my project. I know I can modify the path argument to the writer, but I'm specifically interested in changing the root directory (both for reads and writes) globally, without having to specify it outside of the configuration.</p>