Issue withpassing parameters to the queries in spark sql temporary function

Raghu1216
New Contributor II

I have created a function like below

create function test(location STRING, designation STRING, name STRING)

RETURNS TABLE (cnt INT)

RETURN(

SELECT

CASE WHEN location = 'INDIA' THEN

(SELECT COUNT(*) FROM tbl_customers where job_role = designation)

ELSE (SELECT COUNT(*) FROM tbl_customers where job_role = designation AND c_name = name)

END as cnt

When I'm trying to run this function in adb notebook, I'm getting the error like:- Column designation does not exist. Did you mean one of the following?

Can anyone plz suggest me how to get rid of this error