title: How to find the max String length of a column in Spark using dataframe?
body: <p>I have a dataframe. I need to calculate the Max length of the String value in a column and print both the value and its length.</p>
  
  <p>I have written the below code but the output here is the max length only but not its corresponding value.
  This <a href="https://stackoverflow.com/questions/41270204/how-to-get-max-length-of-string-column-from-dataframe-using-scala">How to get max length of string column from dataframe using scala?</a> did help me out in getting the below query.</p>
  
  <pre><code> df.agg(max(length(col("city")))).show()
  </code></pre>