I am new to Presto, and can't quite figure out how to check if a key is present in a map. When I run a SELECT
query, this error message is returned:
Key not present in map: element
SELECT value_map['element'] FROM
mytable
WHERE name = 'foobar'
Adding AND contains(value_map, 'element')
does not work
The data type is a string array
SELECT typeof('value_map') FROM mytable
returns varchar(9)
How would I only select records where 'element' is present in the value_map
?
varchar
, then it’s a string, not a map. Can you show some example values for the column? – PhysicSELECT typeof(value_map)
would show the type of thevalue_map
.SELECT typeof('value_map')
shows the type of the'value_map'
string literal. – Kathline