title: Is it possible to achieve groupByKey behavior using reduceByKey or aggregateByKey
body: <p>I have the following input </p>
  
  <pre><code>scala&gt; val x = sc.parallelize(Array(("a", 1), ("b", 1), ("a", 1),
       |      | ("a", 1), ("b", 1), ("b", 1),
       |      | ("b", 1), ("b", 1)), 3)
  x: org.apache.spark.rdd.RDD[(String, Int)] = ParallelCollectionRDD[3] at parallelize at &lt;console&gt;:24
  </code></pre>
  
  <p>When I use groupBykey API, </p>
  
  <pre><code>scala&gt; val y = x.groupByKey
  y: org.apache.spark.rdd.RDD[(String, Iterable[Int])] = ShuffledRDD[7] at groupByKey at &lt;console&gt;:25
  
  scala&gt; y.collect
  res20: Array[(String, Iterable[Int])] = Array((a,CompactBuffer(1, 1, 1)), (b,CompactBuffer(1, 1, 1, 1, 1)))
  </code></pre>
  
  <p>With groupByKey it is not necessary to specify any transformation. Since groupByKey is not efficient I cannot use it.</p>
  
  <p>On looking I saw that reduceByKey and aggregateByKey require transformations actions on the input data.</p>
  
  <p>Is it possible to achieve the groupByKey behavior using reduceByKey or aggregateByKey? </p>