我们如何检查数组中的元素是否存在以及它在 Presto 中是否具有 "true" 的值
how do we check if an element in the array exists and if it has a value of "true" in Presto
数组中的数据类似于 XXXX:"False"。我用了
element_at(array_name,'Field') and contains(map_keys(array_name),'Field')
。他们只检查元素是否存在于数组中。但是,如果 'Field' 的值为 'true',我该如何检查该值?
假设你手头有一张地图,并且你想检查给定键的值,你可以只使用 element_at()
:
where element_at(array_name, 'Field') = 'True'
数组中的数据类似于 XXXX:"False"。我用了
element_at(array_name,'Field') and contains(map_keys(array_name),'Field')
。他们只检查元素是否存在于数组中。但是,如果 'Field' 的值为 'true',我该如何检查该值?
假设你手头有一张地图,并且你想检查给定键的值,你可以只使用 element_at()
:
where element_at(array_name, 'Field') = 'True'