title: Selecting column RDD scala-spark
body: <p>I need to do the following operation: selecting each field in the rdd.
  I have to convert it in Scala, expecially the part in the third line, selecting each column:</p>
  
  <pre><code>val rddHash=x.map(row =&gt;(DigestUtils.sha1Hex(row(0).toString.getBytes("UTF-8")),row(1).toString)).reduceByKey((a,b)=&gt;(a+b))
  val z=rddHash.cartesian(rddHash)
  val outRdd=z.map(m =&gt; (m(0)(0),(m(1)(0),euclidean(m(0)(1).split(','),m(1)(1).split(',')))))
  </code></pre>
  
  <p>X is the dataset charged as (String,Object).</p>
  
  <p>But this code doesn't work, the problem is the part related to the third lines in which I try to select elements via m(0)(0),m(1)(0) and so on.
  The error is :</p>
  
  <pre><code>&lt;console&gt;:42: error: ((String, String), (String, String)) does not take parameters
  </code></pre>
  
  <p>How can I select each field in the rdd in Scala?</p>
  
  <p>Ps my code line in pyspark is the following one:</p>
  
  <pre><code>outRdd=cartesian.map(lambda m: (m[0][0],(m[1][0],euclidean(m[0][1].split(','),m[1][1].split(',')))))
  </code></pre>
  
  <p>Where cartesian have the same struucture showed before:</p>
  
  <pre><code>((String, String), (String, String))
  </code></pre>