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 >> Parse MAP viarable Keys in HIVE


Copy link to this message
-
Parse MAP viarable Keys in HIVE
Hi All,

I have a table in Apache Hive and I am interested in a specific field of the table. Table name: Table1 and field name f1. The field f1 is of type MAP<string, string>.

The table is huge. How could I find the distinct key values of the MAP variable f1 above?

I tried:
$hive -e "select distinct map_keys(f1) from Table1;"
$hive -e "select k from Table1 LATERAL VIEW explode(f1) et as k,v;"

Each of the above returned syntax error. Could you please help.

If the existing values for a few fields of the table ate:
<x, y>
<x, p>
<m, n>
<empty>
<m, m>
<p, q>

I want the return to be:
x
m
p

Thanks a lot.
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