title: What are the Spark transformations that causes a Shuffle?
body: <p>I have trouble to find in the Spark documentation operations that causes a shuffle and operation that does not. In this list, which ones does cause a shuffle and which ones does not? </p>
  
  <p>Map and filter does not. However, I am not sure with the others.</p>
  
  <pre><code>map(func)
  filter(func)
  flatMap(func)
  mapPartitions(func)
  mapPartitionsWithIndex(func)
  sample(withReplacement, fraction, seed)
  union(otherDataset)
  intersection(otherDataset)
  distinct([numTasks]))
  groupByKey([numTasks])
  reduceByKey(func, [numTasks])
  aggregateByKey(zeroValue)(seqOp, combOp, [numTasks])
  sortByKey([ascending], [numTasks])
  join(otherDataset, [numTasks])
  cogroup(otherDataset, [numTasks])
  cartesian(otherDataset)
  pipe(command, [envVars])
  coalesce(numPartitions)
  </code></pre>