gpt4 book ai didi

sql - Hive Query : Trying to string match using WHERE, LIKE on map

转载 作者:可可西里 更新时间:2023-11-01 14:45:17 24 4
gpt4 key购买 nike

我是 Hive 的新手,正在尝试进行类似于以下内容的搜索:

SELECT * FROM table1 WHERE col1 LIKE "%abcd%";

但是,当我这样做时,出现以下错误:

Error while compiling statement: FAILED: SemanticException [Error 10014]: Line 1:30 Wrong arguments '"%abcd%"': No matching method for class org.apache.hadoop.hive.ql.udf.UDFLike with (map, string). Possible choices: FUNC(string, string)

看起来col1的类型不对,是map的数据类型。有没有一种简单的方法可以在此列中搜索“%abcd%”模式?谢谢!

最佳答案

这很可能是你想要的

select  *
from mytable
where concat_ws(',',map_values(mymap)) like '%abcd%'

关于sql - Hive Query : Trying to string match using WHERE, LIKE on map<string, string>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43326172/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com