Spark RDD tuple transformation
<p>I'm trying to transform an RDD of tuple of Strings of this format : </p>

<p><code>(("abc","xyz","123","2016-02-26T18:31:56"),"15")</code> TO <br></p>

<pre><code>(("abc","xyz","123"),"2016-02-26T18:31:56","15")
</code></pre>

<p>Basically seperating out the timestamp string as a seperate tuple element. I tried following but it's still not clean and correct.</p>

<pre><code>val result = rdd.map(r =&gt; (r._1.toString.split(",").toVector.dropRight(1).toString, r._1.toString.split(",").toList.last.toString, r._2))
</code></pre>

<p>However, it results in </p>

<pre><code>(Vector(("abc", "xyz", "123"),"2016-02-26T18:31:56"),"15")
</code></pre>

<p>The expected output I'm looking for is </p>

<pre><code>(("abc", "xyz", "123"),"2016-02-26T18:31:56","15")
</code></pre>

<p>This way I can access the elements using <code>r._1</code>, <code>r._2</code> (the timestamp string) and <code>r._3</code> in a seperate map operation. </p>

<p>Any hints/pointers will be greatly appreciated.</p>