title: Too many arguments in method in udf, scala
body: <p>I have udf function for calculating distance between 2 coordinates.</p>
  
  <pre><code>import org.apache.spark.sql.functions._
  import scala.math._
  
  def  calculateDistance(la1:Double, lo1:Double,la2:Double,lo2:Double): Double   =&gt;  udf(
  {
  
  val  R = 6373.0
  val  lat1 = toRadians(la1)
  val  lon1 = toRadians(lo1)
  val  lat2 = toRadians(la2)
  val  lon2 = toRadians(lo2)
  
  val  dlon = lon2 - lon1
  val  dlat = lat2 - lat1
  
  val  a = pow(sin(dlat / 2),2) + cos(lat1) * cos(lat2) * pow(sin(dlon / 2),2)
  val  c = 2 * atan2(sqrt(a), sqrt(1 - a))
  
  val  distance = R * c
  }
  )
  </code></pre>
  
  <p>Here is the dataframe schema .</p>
  
  <pre><code>dfcity: org.apache.spark.sql.Dataset[org.apache.spark.sql.Row] = [Name: string, LAT: double ... 10 more fields]
  root
  |-- SCITY: string (nullable = true)
  |-- LAT: double (nullable = true)
  |-- LON: double (nullable = true)
  |-- ADD: integer (nullable = true)
  |-- CODEA: integer (nullable = true)
  |-- CODEB: integer (nullable = true)
  |-- TCITY: string (nullable = true)
  |-- TLAT: double (nullable = true)
  |-- TLON: double (nullable = true)
  |-- TADD: integer (nullable = true)
  |-- TCODEA: integer (nullable = true)
  |-- TCODEB: integer (nullable = true)
  </code></pre>
  
  <p>When trying using withColumn </p>
  
  <pre><code>val dfcitydistance = dfcity.withColumn("distance", calculateDistance($"LAT", $"LON",$"TLAT", $"TLON"))
  it generates error:
  6: error: too many arguments for method calculateDistance: (distance: Double)
  </code></pre>
  
  <p>What's wrong in the code the passing column to UDF? Please advise. Thank you very much.</p>