The line:
df.withColumn("test", expr("concat(lon, lat)"))
works as expected but
df.withColumn("test", expr("concat(lon, lit(','), lat)"))
produces the following exception:
org.apache.spark.sql.AnalysisException: Undefined function: 'lit'. This function is neither a registered temporary function nor a permanent function registered in the database 'default'.; line 1 pos 12 at org.apache.spark.sql.catalyst.analysis.Analyzer$LookupFunctions$$anonfun$apply$15$$anonfun$applyOrElse$49.apply(Analyzer.scala:1198)
Why? And what would be the workaround?