title: too many arguments for method apply: (i: Int)String in class Array
body: <p>I have an RDD (r2Join1) which holds the following data</p>
  
  <pre><code>(100,(102|1001,201))
  (100,(102|1001,200))
  (100,(103|1002,201))
  (100,(103|1002,200))
  (150,(151|1003,204))
  </code></pre>
  
  <p>I want to transform this to the following</p>
  
  <pre><code>(102, (1001, 201))
  (102, (1001, 200))
  (103, (1002, 201))
  (103, (1002, 200))
  (151, (1003, 204))
  </code></pre>
  
  <p>i.e., I want to transform (k, (v1|v2, v3)) to (v1, (v2, v3)).</p>
  
  <p>I did the following: </p>
  
  <pre><code>val m2 = r2Join1.map({case (k, (v1, v2)) =&gt; val p: Array[String] = v1.split("\\|") (p(0).toLong, (p(1).toLong, v2.toLong))})
  </code></pre>
  
  <p>I get the following error</p>
  
  <pre><code>error: too many arguments for method apply: (i: Int)String in class Array
  </code></pre>
  
  <p>I am new to Spark &amp; Scala. Please let me know how this error can be resolved.</p>