I think you have to use \004 and \005 as delimiters for your inner maps.

-----Original Message-----
From: Sammy Yu [mailto:s...@brightedge.com] 
Sent: Friday, September 10, 2010 11:13 AM
To: hive-user@hadoop.apache.org
Subject: Map<string, Map<string, string>> for TEXTFILE

Hi guys,
   I'm trying to create a textfile for a table with a Map<string,
Map<string, string>> column:

CREATE EXTERNAL TABLE map_test
(id int,
m MAP<string, MAP<string, string>>)
row format delimited fields terminated by '\001'
  escaped by '\004'
  collection items terminated by '\002'
  map keys terminated by '\003;
location '/user/hadoop/map_test';

I can't seem to figure out how to construct the serialized textfile
form for the value of the inner map.  I've create a file with the
following content:
100<\001>physical<\003>height<\003>60<\002>weight<\003>120.5<\003>inner<\003>outgoing<\003>5.2
to represent id=100, m={"physical":{"height":"60",
"weight":"120.5"},"inner":{"outgoing:"5.2"}}

however when I do a query I get:
hive> select * from map_test;
100     
{"physical":{"height\u000360":null},"weight":{"120.5":null},"inner":{"outgoing\u00035.2":null}}

I think I'm suppose to escape the value of the outer map's key.  Any
help would be greatly appreciated!

Thanks,
Sammy

Reply via email to