Array to Tuple in Spark with many input variables
<p>Lets say I am importing a flat file from HDFS into spark using something like the following:</p>

<pre><code>val data = sc.textFile("hdfs://name_of_file.tsv").map(_.split('\t'))
</code></pre>

<p>This will produce an <code>Array[Array[String]]</code>.  If I wanted an array of tuples I could do as referenced in this <a href="https://stackoverflow.com/questions/12585549/how-to-convert-an-array-to-a-tuple">solution</a> and map the elements to a tuple.</p>

<pre><code>val dataToTuple = data.map{ case Array(x,y) =&gt; (x,y) }
</code></pre>

<p>But what if my input data has say, 100 columns?  Is there a way in scala using some sort of wildcard to say</p>

<pre><code>val dataToTuple = data.map{ case Array(x,y, ... ) =&gt; (x,y, ...) }
</code></pre>

<p>without having to write out 100 variable to match on?</p>

<p>I tried doing something like </p>

<pre><code>val dataToTuple = data.map{ case Array(_) =&gt; (_) }
</code></pre>

<p>but that didn't seem to make much sense.</p>