I am having trouble trying to define map type in hive. According to Hive Manual there definitely is a map type, unfortunately there aren't any examples on how to use it. :-(
Suppose, I have a table (users) with following columns:
Name Ph CategoryName
This "CategoryName" column has specific set of values. Now I want to create a hashtable that maps CategoryName to CategoryID. I tried doing:
set hivevar:nameToID=map('A',1,'B',2);
I have 2 questions:
When I do
set hivevar:${nameToID['A']}
I thought that it would print out value as 1. But I get "${hivevar:nameToID['A']} is undefined"I am not sure how can I say something like,
select name, ph, ${nameToID[CategoryName]} from users