title: How to split an RDD into many in Spark?
body: <p>If I do the basic <code>groupByKey</code> operation on a <code>JavaRdd&lt;Tuple2&lt;String, String&gt;&gt;</code>, I get a <code>JavaPairRdd&lt;Tuple2&lt;String, Iterable&lt;String&gt;&gt;&gt;</code>:</p>
  
  <pre><code>someStartRdd.groupByKey()
  </code></pre>
  
  <p>because the size of the iterables in every tuple is going to be quite big (millions) and the number of keys is going to be big too, I'd like to process each iterable in a streaming parallel fashion like with RDD. Ideally I'd like an RDD per key. </p>
  
  <p>For the moment the only thing I could think of is to collect, create lists and then <code>parallelize</code>:</p>
  
  <pre><code>List&lt;Tuple2&lt;String, Iterable&lt;String&gt;&gt;&gt; r1 = someStartRdd.groupByKey().collect();
  for (Tuple2&lt;String, Iterable&lt;String&gt;&gt; tuple : r1){
      List&lt;String&gt; listForKey = MagicLibrary.iterableToString(tuple._2());
      JavaRdd&lt;String&gt; listRDD = sparkContext.parallelize(listForKey);
      ...start job on listRDD...
  }
  </code></pre>
  
  <p>but I don't want to put all things in memory to create the list. Better solution?</p>