Issue withpassing parameters to the queries in spark sql temporary function
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 05:26 AM
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