title: What is the use of lit() in spark? The below two piece of code returns the same output, what is the benefit of using lit()
body: <p>I have two piece of codes here</p>
  
  <pre><code>gooddata = gooddata.withColumn("Priority",when(gooddata.years_left &lt; 5 &amp; (gooddata.Years_left &gt;= 0),lit("CRITICAL"))).fillna("LOW").show(5)
  
  gooddata=gooddata.withColumn("Priority",when((gooddata.Years_left &lt; 5) &amp; (gooddata.Years_left &gt;= 0),"CRITICAL").otherwise("LOW")).show(5)
  </code></pre>