title: spark dataframe trim column and convert
body: <p>In Scala / Spark, how to convert empty string, like "      ", to "NULL" ? need to trim it first and then convert to "NULL". Thanks.</p>
  
  <pre><code>dataframe.na.replace("cut", Map(" " -&gt; "NULL")).show //wrong
  </code></pre>