I am new to Presto SQL and I am trying to map items but receiving a 'Key not present in map:formId' error. I was wondering how to handle mapping when one of the keys is missing? When I remove that particular key, the query runs just fine. But in the future, this key may have data and so removing it does not help in the long run. I have seen suggestions to use element_at but I am not sure how to implement that. Additionally, I have tried COALESCE(TRY() but it will only take one argument and not an array.
What I currently have:
with list as(
select t.week,t.event,t.team,t.continent,t.country
from table as t
where t.date >= '2022-02-10'
and t.team_name IN ('charlie','Anna')
and COALESCE(
t.info['formId'],
t.info['roomId'],
t.info['hall_name'],
t.info['teAM_id']) IN ('catalog 0', 'catalog 1', 'catalog 2', 'catalog 3', 'catalog 4')
)
select * from list
The error I am receiving is 'Key not present in map:formId'