You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Jonathan Meed <jm...@umich.edu> on 2011/11/01 17:56:30 UTC

Using the map data type

Hi Hive Experts.


I think I may have found a bug in hive and was wondering if there is a
better workaround then the one I am using.  When I run the script below all
the values for the map are null, I.E.  beacon.QS['cid'] is null.

FROM
(from beacons
   select TRANSFORM(ipaddress, ipaddress2, identd, user, finishtime,
requestline, returncode, size, referer, userAgent ) using
'hdfs://privateIP/PlacementId.pl'
   as (ipaddress STRING, ipaddress2 STRING, identd STRING, user
STRING,finishtime STRING, QS MAP<STRING, STRING>, returncode INT, size INT,
referer STRING, userAgent STRING)
   where dt="2011-10-29"
) beacon
insert overwrite table beacon_processed PARTITION(dt="2011-10-25", hour=1,
minute=1, type="click")
SELECT beacon.ipaddress, beacon.user, beacon.QS['cid'], beacon.QS['pid'],
beacon.QS['PlacementId'], beacon.QS, returncode, size;
select * from beacon_processed limit 200;


On the other hand if I just do a select on the map data type I get the
values from the map.
SELECT ipaddress, user_agent, querystring['cid'], querystring['pid'],
querystring['PlacementId'], returncode, size FROM beacon_processed  limit
200;

Is this a bug or am I doing something wrong

Jonathan Meed
University of Michigan
School of Engineering Class of 2013
jmeed@umich.edu
917-880-7974