I need to call a function from my spark sql queries. I have tried udf but I don't know how to manipulate it. Here is the scenario:
# my python function example
def sum(effdate, trandate):
sum=effdate+trandate
return sum
and my spark sql query is like:
spark.sql("select sum(cm.effdate, cm.trandate)as totalsum, name from CMLEdG cm ....").show()
These lines are not my code but I am stating it as an example. How could I call my sum function inside spark.sql(sql queries) for getting a result? Could you please kindly suggest me any link or any comment compatible with pyspark?
Any help would be appreciated.
Thanks
Kalyan