Home | About | Sematext search-lucene.com search-hadoop.com
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> Any existing UDTF to flatten map


Copy link to this message
-
Any existing UDTF to flatten map
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.
NEW: Monitor These Apps!
elasticsearch, apache solr, apache hbase, hadoop, redis, casssandra, amazon cloudwatch, mysql, memcached, apache kafka, apache zookeeper, apache storm, ubuntu, centOS, red hat, debian, puppet labs, java, senseiDB