title: Get max length in column for each column in a dataframe
body: <p>I have a Spark dataframe like that </p>
  
  <pre><code>+-----------------+---------------+----------+-----------+
  |     column1     |    column2    | column3  |  column4  |
  +-----------------+---------------+----------+-----------+
  | a               | bbbbb         | cc       | &gt;dddddddd |
  | &gt;aaaaaaaaaaaaaa | bb            | c        | dddd      |
  | aa              | &gt;bbbbbbbbbbbb | &gt;ccccccc | ddddd     |
  | aaaaa           | bbbb          | ccc      | d         |
  +-----------------+---------------+----------+-----------+
  </code></pre>
  
  <p>I would like to find a length of the longest element in each column to obtain something like that</p>
  
  <pre><code>+---------+-----------+
  | column  | maxLength |
  +---------+-----------+
  | column1 |        14 |
  | column2 |        12 |
  | column3 |         7 |
  | column4 |         8 |
  +---------+-----------+
  </code></pre>
  
  <p>I know how to do it column by column but don't know how to tell Spark - <code>Do it for all columns</code> .</p>
  
  <p>I am using Scala Spark. </p>