Split String Column on the Dataset<Row> with comma and get new Dataset<Row>
<p>I am working on Spark SQL with Spark(2.0) and using Java API for reading CSV. </p>

<p>In CSV file there is a double quotes, comma separated Column. Ex: <code>"Express Air,Delivery Truck"</code> </p>

<p>Code for reading CSV and returning Dataset:</p>

<pre><code>Dataset&lt;Row&gt; df = spark.read()
                .format("com.databricks.spark.csv")
                .option("inferSchema", "true")
                .option("header", "true")
                .load(filename) 
</code></pre>

<p>Result:</p>

<pre><code>+-----+--------------+--------------------------+
|Year |       State  |                Ship Mode |...
+-----+--------------+--------------------------+
|2012 |New York      |Express Air,Delivery Truck|...
|2013 |Nevada        |Delivery Truck            |...
|2013 |North Carolina|Regular Air,Delivery Truck|...
+-----+--------------+--------------------------+
</code></pre>

<p>But, I want to split <code>Shop Mode</code> to <code>Mode1</code> and <code>Mode2</code> Column and return as a Dataset.</p>

<pre><code>+-----+--------------+--------------+---------------+
|Year |       State  |     Mode1    |         Mode2 |...
+-----+--------------+--------------+---------------+
|2012 |New York      |Express Air   |Delivery Truck |...
|2013 |Nevada        |Delivery Truck|null           |...
|2013 |North Carolina|Regular Air   |Delivery Truck |...
+-----+--------------+--------------+---------------+
</code></pre>

<p>Is there any way I can do this using Java Spark?</p>

<p>I tried with MapFunction, but call() method not returning Row. 
<code>Ship Mode</code> will be Dynamic i.e, CSV may contain one Ship Mode or two.  </p>

<p>Thanks.</p>