遵循Office文档https://prestosql.io/docs/current/functions/map.html。我使用“ map_entries”将映射分解为array(row(K,V))结构。我的问题是如何从行对象中提取K和V值?目前,我必须将其重铸到我定义的Row对象。
select
type.n , type.b
from
(select
CAST(type AS ROW(n VARCHAR, b VARCHAR)) as type
from
search.yli_tmp_trevi_requests_mini
cross join
unnest (map_entries(cast(json_extract(req, '$.types') as MAP<VARCHAR, VARCHAR>))) t (type)
) t
where
type.n = 'apple'