Spark dataframe explode function
<p>Can anyone please explain why case <code>Row</code>, <code>Seq[Row]</code> are used after the explode of a <code>dataframe</code> field which has collection of elements.
And also can you please explain me the reason why asInstanceOf is required to get the values from the exploded field?</p>

<p>Here is the syntax:</p>

<pre><code>val explodedDepartmentWithEmployeesDF = departmentWithEmployeesDF.explode(departmentWithEmployeesDF("employees")) {     
                          case Row(employee: Seq[Row]) =&gt; 
                          employee.map(employee =&gt;
                          Employee(employee(0).asInstanceOf[String], 
                          employee(1).asInstanceOf[String], employee(2).asInstanceOf[String]) ) }
</code></pre>