title: Get value from a map for a column value as a key in spark dataframes
body: <p>I was to get a value from a map from column value as key and create a new column</p>
  
  <p>I have tried the following</p>
  
  <pre><code>val testMap = Map("abc" -&gt; "1234", "xyz" -&gt; "3456")
  
  def checkthemap (testmap: Map[String, String], key: String) : String = {
      val value = testmap.get(key)
      if (value == null) "" else value.toString
  }
  
  val testDF = analysis
      .withColumn("test", lit(checkthemap(testMap,$"col")))
  </code></pre>
  
  <p>Method accepts the string not the column. How do I change my withColumn statement to send column value as string to a method.</p>