@Aman Sehgal​ 

thanks for your response , I update the sample mapping example

I already have mapping logic in the mappingsheet so do I still need this extra function now ... can I directly store this SQL logic in a variable and directly exeute like below.

Pyspark code :

variable = df.select("mappinglogic").collect()[0]

df_spark_sql = spark.sql(variable )

and after that if I want to perform any further operation , I can easily do it in df_spark_sql dataframe