Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Hive, mail # user - Any existing UDTF to flatten map


Copy link to this message
-
Any existing UDTF to flatten map
xu ji 2012-11-30, 18:18
Hi all,
  I have a table like this:
hive> desc mytable;
ts bigint
content map<string,string>
hive> select * from mytable;
1354299050        {"F1":"id-1"}
1354299040        {"F1":"id-2","F2":"id-3"}
1354299030        {"F1":"id-3","F2":"id-1","F3":"id-4"}

Does anyone know how to generate a table like this:

hive> desc resulttable;
id string
ts bigint
hive> select * from resulttable;
id-1        1354299050
id-2        1354299040
id-3        1354299040
id-3        1354299030
id-1        1354299030
id-4        1354299030
I mean I can certainly write a UDTF to generate a table like this, but I
wonder is there an existing UDTF to do this job?

Thanks,
Xu

--
Ji Xu
Mobile: (+86) 138-115-10101
E-mail: [EMAIL PROTECTED]
Homepage: http://about.me/jixu

Room 825, School of Software,
Main Building, Tsinghua University,
Beijing, 100084, P. R. China.
+
Matt Tucker 2012-11-30, 19:39