我有一个包含以下两列的表事件详细信息列的格式为map(string,string)我想获得在事件详细信息中具有值(b)的访客数量
rjee0c151#
查询行 where event_detail["value(B)"] is not null :
where event_detail["value(B)"] is not null
select visitor_number from table where event_detail["value(B)"] is not null
演示:创建测试表:
hive> create table test_t(visitor_number int,event_detail map<string,string>); OK
加载数据:
hive> insert into test_t select 123, map("value(B)","Bye") union all select 123, map("value(G)","Jet"); OK
选择值为(b)的行:
hive> select visitor_number from test_t where event_detail["value(B)"] is not null; OK 123
1条答案
按热度按时间rjee0c151#
查询行
where event_detail["value(B)"] is not null
:演示:
创建测试表:
加载数据:
选择值为(b)的行: