title: How reduceByKey in RddPair<K,Tuple> in Scala
body: <p>I have this a CassandraTable. Access by SparkContext.cassandraTable(). Retrieve all my CassandraRow.</p>
  
  <p>Now I want to store 3 information: (user, city, byte)
  I store like this</p>
  
  <pre><code>rddUsersFilter.map(row =&gt;
  (row.getString("user"),(row.getString("city"),row.getString("byte").replace(",","").toLong))).groupByKey
  </code></pre>
  
  <p>I obtain a RDD[(String, Iterable[(String, Long)])]
  Now for each user I want to sum all bytes and create a Map for city like: "city"->"occurencies" (how many time this city appairs for this user).</p>
  
  <p>Previously, I split up this code in two differnt RDD, one to sum byte, the other one to create map as described.</p>
  
  <p>Example for occurency for City</p>
  
  <pre><code>rddUsers.map(user =&gt; (user._1, user._2.size, user._2.groupBy(identity).map(city =&gt; (city._1,city._2.size))))
  </code></pre>
  
  <p>that's because I could access to second element of my tuple thanks to ._2 method. But now?
  My second element is a Iterable[(String,Long)], and I can't map anymore like I did before.</p>
  
  <p>Is there a solution to retrieve all my information with just one rdd and a single MapReduce?</p>