Thanks Vishnu, When restart the service the UDF was not accessible by my query.I need to run the mentioned block again to use the UDF. Is there is any way to maintain UDF in sqlContext permanently?
Thanks, Vinod On Wed, Jul 8, 2015 at 7:16 AM, VISHNU SUBRAMANIAN < johnfedrickena...@gmail.com> wrote: > Hi, > > sqlContext.udf.register("udfname", functionname _) > > example: > > def square(x:Int):Int = { x * x} > > register udf as below > > sqlContext.udf.register("square",square _) > > Thanks, > Vishnu > > On Wed, Jul 8, 2015 at 2:23 PM, vinod kumar <vinodsachin...@gmail.com> > wrote: > >> Hi Everyone, >> >> I am new to spark.may I know how to define and use User Define Function >> in SPARK SQL. >> >> I want to use defined UDF by using sql queries. >> >> My Environment >> Windows 8 >> spark 1.3.1 >> >> Warm Regards, >> Vinod >> >> >> >