title: Spark parallelize and partition by key
body: <p>In Spark, I can do</p>
  
  <pre><code>sc.parallelize([(0, 0), (1, 1), (0, 2), (1, 3), (0, 4), (1, 5)], 2).partitionBy(2)
  </code></pre>
  
  <p>However, this first distributes the data across the nodes of the cluster, only to then shuffle it again. Is there a way to partition by key immediately when the data are entered from the driver program?</p>