Hi
Can you try below :
We are registering using spark.sql.function.udf :
def *myUDF*(wgts: *Int*, amnt: *Float*) = (wgts*amnt)/100.asInstanceOf[
Float]
val *myUdf* = udf(myUDF(_:int,_:Float))
>
Now you can invoke the function directly in spark sql or outside.
Thanks,
Paras Sachdeva
On Wed, Ap
Hi,
I am using Spark 1.5.2 and defined below udf
import org.apache.spark.sql.functions.udf
> val myUdf = (wgts : Int , amnt :Float) => {
> (wgts*amnt)/100.asInstanceOf[Float]
> }
>
val df2 = df1.withColumn("WEIGHTED_AMOUNT",callUDF(udfcalWghts,
FloatType,col("RATE"),col("AMOUNT")))
In my sc