title: Not able to apply function to Spark Dataframe Column
body: <p>I am trying to apply a function to one of my dataframe columns to convert the values. The values in the column are like "20160907" I need value to be "2016-09-07".</p>
  
  <p>I wrote a function like this:</p>
  
  <pre><code>def convertDate(inDate:String ): String = {
     val year = inDate.substring(0,4)
     val month = inDate.substring(4,6)
     val day = inDate.substring(6,8)
  
     return year+'-'+month+'-'+day
  }
  </code></pre>
  
  <p>And in my spark scala code, I am using this:</p>
  
  <pre><code>def final_Val {
    val oneDF = hiveContext.read.orc("/tmp/new_file.txt")
    val convertToDate_udf = udf(convertToDate _)
    val convertedDf = oneDF.withColumn("modifiedDate", convertToDate_udf(col("EXP_DATE")))
    convertedDf.show()
  }
  </code></pre>
  
  <p>Suprisingly, in spark shell I am able to run without any error. In scala IDE I am getting the below compilation error:</p>
  
  <pre><code>Multiple markers at this line:
  not enough arguments for method udf: (implicit evidence$2: 
  reflect.runtime.universe.TypeTag[String], implicit evidence$3: reflect.runtime.universe.TypeTag[String])org.apache.spark.sql.UserDefinedFunction. Unspecified value parameters evidence$2, evidence$3.
  </code></pre>
  
  <p>I am using Spark 1.6.2, Scala 2.10.5</p>
  
  <p>Can someone please tell me what I am doing wrong here? </p>
  
  <p>Same code I tried with different functions like in this post: stackoverflow.com/questions/35227568/applying-function-to-spark-dataframe-column".
  I am not getting any compilation issues with this code. I am unable to find out the issue with my code</p>