title: Spark SQL nested withColumn
body: <p>I have a DataFrame that has multiple columns of which some of them are structs.  Something like this</p>
  
  <pre><code>root
   |-- foo: struct (nullable = true)
   |    |-- bar: string (nullable = true)
   |    |-- baz: string (nullable = true)
   |-- abc: array (nullable = true)
   |    |-- element: struct (containsNull = true)
   |    |    |-- def: struct (nullable = true)
   |    |    |    |-- a: string (nullable = true)
   |    |    |    |-- b: integer (nullable = true)
   |    |    |    |-- c: string (nullable = true)
  </code></pre>
  
  <p>I want to apply a <code>UserDefinedFunction</code> on the column <code>baz</code> to replace <code>baz</code> with a function of <code>baz</code>, but I cannot figure out how to do that.  Here is an example of the desired output (note that <code>baz</code> is now an <code>int</code>)</p>
  
  <pre><code>root
   |-- foo: struct (nullable = true)
   |    |-- bar: string (nullable = true)
   |    |-- baz: int (nullable = true)
   |-- abc: array (nullable = true)
   |    |-- element: struct (containsNull = true)
   |    |    |-- def: struct (nullable = true)
   |    |    |    |-- a: string (nullable = true)
   |    |    |    |-- b: integer (nullable = true)
   |    |    |    |-- c: string (nullable = true)
  </code></pre>
  
  <p>It looks like <code>DataFrame.withColumn</code> only works on top level columns but not on nested columns.  I'm using Scala for this problem.</p>
  
  <p>Can someone help me out with this?</p>
  
  <p>Thanks</p>