title: How do I group Cassandra rows in Scala
body: <p>Given I have some <code>SparkSql</code> <code>RDD</code> results:</p>
  
  <pre class="lang-scala prettyprint-override"><code>CassandraRow{location_id: 163169767097254, context: drinking beer}
  CassandraRow{location_id: 376101312892, context: drinking beer}
  CassandraRow{location_id: 218866401458875, context: drinking beer}
  CassandraRow{location_id: 163169767097254, context: drinking beer}
  CassandraRow{location_id: 103760882995742, context: drinking beer}
  CassandraRow{location_id: 214680441881239, context: drinking beer}
  CassandraRow{location_id: 376101312892, context: ice creams}
  CassandraRow{location_id: 193809797319052, context: drinking beer}
  CassandraRow{location_id: 106017852771295, context: drinking beer}
  CassandraRow{location_id: 166686436690629, context: drinking beer}
  CassandraRow{location_id: 203328349712668, context: drinking beer}
  CassandraRow{location_id: 103760882995742, context: vacations}
  CassandraRow{location_id: 203328349712668, context: drinking beer}
  CassandraRow{location_id: 214680441881239, context: drinking beer}
  CassandraRow{location_id: 214680441881239, context: drinking beer}
  CassandraRow{location_id: 376101312892, context: drinking beer}
  CassandraRow{location_id: 166686436690629, context: vacations}
  CassandraRow{location_id: 218866401458875, context: ice creams}
  </code></pre>
  
  <p>I would like to group them by <code>location_id</code> to get results like below:</p>
  
  <pre class="lang-scala prettyprint-override"><code>List(
    218866401458875 -&gt; List(ice creams, drinking beer),
    166686436690629 -&gt; List(vacations, drinking beer),
    376101312892 -&gt; List(ice creams, drinking beer)
    // and so on
  )
  </code></pre>
  
  <p>So far this is my code:</p>
  
  <pre class="lang-scala prettyprint-override"><code>val mappedContext = context.map(c =&gt; (c.getLong("location_id"), c.getString("context")))
  val grouped = mappedContext.groupBy(_._1).mapValues(_.map(_._2))
      grouped.foreach(k =&gt; {
      println(k)
  
  })
  </code></pre>
  
  <p>But I am getting:</p>
  
  <pre><code>(203328349712668,[Ljava.lang.String;@682d0831)
  (106017852771295,[Ljava.lang.String;@3ed36a4c)
  (193809797319052,[Ljava.lang.String;@1649ca17)
  (214680441881239,[Ljava.lang.String;@9c9d648)
  (103760882995742,[Ljava.lang.String;@9253bc0)
  (376101312892,[Ljava.lang.String;@2c01a1a2)
  (166686436690629,[Ljava.lang.String;@74c0cf47)
  (163169767097254,[Ljava.lang.String;@33fc3c01)
  (218866401458875,[Ljava.lang.String;@13a7ea85)
  (500767133335647,[Ljava.lang.String;@328a55e2)
  </code></pre>