I'm using spark sql to create a query. The actual query is bit large in size but the issue I'm getting is the following error
Error in SQL statement: AnalysisException: IN/EXISTS predicate sub-queries can only be used in a Filter: Aggregate
And the following part of the query is causing the trouble. I am not sure
select col1, col2,
sum(case
WHEN snoozed_until is NULL
AND hired is NULL
AND lower(profile_archive_status) = 'true'
AND profile_id NOT IN
(SELECT profile_id
FROM candidates_feedback f
WHERE lower(f.a1) LIKE '%no%') THEN
1
ELSE 0 END) Archived,
sum(case
WHEN snoozed_until is NULL
AND hired is NULL
AND lower(profile_archive_status) = 'true'
AND profile_id IN (SELECT profile_id FROM candidates_feedback f WHERE lower(f.a1) LIKE '%no%') THEN 1 ELSE 0 END) Rejected,
from table;