0

所以我试图在 Presto 上为 Qubole 查询应用一个简单的类似函数。对于字符串数据类型,我可以简单地做 '%United States of America%'

但是,对于我尝试应用的列,其基础数据类型为“map”,因此查询失败。如何为 map 数据类型编写 like 运算符,以便它仅获取与模式匹配的列。

4

1 回答 1

1

请参阅https://trino.io/docs/current/functions/map.html Presto 中有关地图相关功能的文档

您应该能够使用map_filter过滤掉所需的条目。例如:

SELECT map_filter(MAP(ARRAY['India', 'Poland', 'United States of America'], ARRAY[20, 3, 15]), (k, v) -> k like '%United States of America%');

             _col0             
-------------------------------
 {United States of America=15} 
(1 row)
于 2020-04-03T04:22:50.260 回答