在 hive 的列中查找值
我在hive中有一个要求,在列中查找一个值,数据是“;”单列中的分隔值。如果我需要的值存在,则结果应该为 TRUE,否则为 FALSE。
例如:单列中的数据为
Row1:保险;金融;电信
Row2:保险、零售
Row3:金融、电信、内部
像这样,我在一列中有不同的值。 我想知道该列是否包含“财务”。如果存在,则输出结果应为 TRUE,否则为 FALSE
: 第 1 行:正确
第 2 行:错误
第 3 行:正确
请帮忙。提前致谢。
I have a requirement in hive to find a value in a column, data is ";" separated values in single column. if my required value present it should result TRUE else FALSE.
Ex: data in a single column is
Row1: insurance;finance;telecom
Row2: insurance, retail
Row3: finance, telecom, internal
Like this I have different values in a column.
I wanted to find if the column contains "finance" or not. If present it should result TRUE else FALSE
output:
Row1: TRUE
Row2: FALSE
Row3: TRUE
Please help. Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您正在寻找单个硬编码值,可以使用 like 运算符。
where col like '%finance%'.
但是如果你希望它是来自另一个表的变量 qnd,你可以像这样使用它
If you are looking for single hardcode value, you can use like operator.
where col like '%finance%'.
But if you want it to be a variable qnd coming from another table you can use it like this