Reputation: 161
I have a table with the following two columns
The format of event_detail column is map(string,string)
I want to obtain the visitor numbers who have value(B) in the event_detail
Upvotes: 3
Views: 4942
Reputation: 38325
Query rows where event_detail["value(B)"] is not null
:
select visitor_number
from table
where event_detail["value(B)"] is not null
Demo:
Create test table:
hive> create table test_t(visitor_number int,event_detail map<string,string>);
OK
load data:
hive> insert into test_t select 123, map("value(B)","Bye") union all select 123, map("value(G)","Jet");
OK
Select rows with value(B):
hive> select visitor_number from test_t where event_detail["value(B)"] is not null;
OK
123
Upvotes: 4