title: Spark create UDF that doesn't take in input
body: <p>I want to add a column with a randomly generated id to my Spark dataframe. To do that, I'm using a UDF to call UUID's random UUID method, like so:</p>
  
  <pre><code>def getRandomId(s:String) : String = {
      UUID.randomUUID().toString()
  }
  
  val idUdf = udf(getRandomId(_:String))
  val newDf = myDf.withColumn("id", idUdf($"colName"))
  </code></pre>
  
  <p>Obviously, my getRandomId function does not need an input parameter; however, I can't figure out how to create a UDF that does not take in a column as input. Is that possible in Spark? </p>
  
  <p>I am using Spark 1.5</p>