Dictionary 如何从映射(字符串,字符串)字段中获取特定值?

Dictionary 如何从映射(字符串,字符串)字段中获取特定值?,dictionary,hive,hiveql,Dictionary,Hive,Hiveql,我有一个包含以下两列的表 事件详细信息列的格式为map(字符串,字符串) 我想获得在事件详细信息中具有值(B)的访客编号 查询行,其中事件详细信息[“值(B)”]不为空: 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

我有一个包含以下两列的表

事件详细信息列的格式为map(字符串,字符串)

我想获得在事件详细信息中具有值(B)的访客编号


查询行
,其中事件详细信息[“值(B)”]不为空

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
选择具有值(B)的行:


@杜杜马尔科维茨
hive> insert into test_t select 123, map("value(B)","Bye") union all  select 123, map("value(G)","Jet");
OK
hive> select visitor_number from test_t where event_detail["value(B)"] is not null;
OK
123