How to apply a function to a column of a Spark DataFrame?
<p>Let's assume that we have a Spark DataFrame</p>

<pre><code>df.getClass
Class[_ &lt;: org.apache.spark.sql.DataFrame] = class org.apache.spark.sql.DataFrame
</code></pre>

<p>with the following schema</p>

<pre><code>df.printSchema
root
|-- rawFV: string (nullable = true)
|-- tk: array (nullable = true)
|    |-- element: string (containsNull = true)
</code></pre>

<p>Given that each row of the <code>tk</code> column is an array of strings, how to write a Scala function that will return the number of elements in each row?</p>