title: Saving double RDD into file - Scala
body: <p>I am trying to save in a file a double RDD, what I mean by a double RDD is that I have this variable:</p>
  
  <pre><code>res: org.apache.spark.rdd.RDD[org.apache.spark.rdd.RDD[((String,String), Int)]] = MapPartitionsRDD[19] 
  </code></pre>
  
  <p>I tried to store it with </p>
  
  <pre><code>res.saveAsTextFile(path)
  </code></pre>
  
  <p>But it doesn't work, an exception is launched because Spark does not support nested RDD here is a sample of the code:</p>
  
  <pre><code>val res = Listword.map { x =&gt;
  Listword.map { y =&gt;
    ((x._1, y._1), x._2 + y._2)
  }
  }
  res.saveAsTextFile("C:/Users/Administrator/Documents/spark/spark-1.6.0-bin-hadoop2.6")
  </code></pre>