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 >> hive map field question


Copy link to this message
-
RE: hive map field question
Thanks, Mark.  I'll try that.  

Also, is there a way to list all the keys and values in a map field?

Thanks,
Chalcy

-----Original Message-----
From: Mark Grover [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 23, 2011 11:01 AM
To: [EMAIL PROTECTED]
Subject: Re: hive map field question

Hi Chalcy,
You could write a UDF that takes in a Map object and returns you the string you need.

Alternatively, you could use Hive Transform. Details here:https://cwiki.apache.org/confluence/display/Hive/LanguageManual+Transform

When a map gets passed to your custom transform script, you could read it as a serialized string.

Mark

----- Original Message -----
From: "Chalcy Raja" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Sent: Wednesday, November 23, 2011 10:48:07 AM
Subject: hive map field question
Hello HiveUsers,

I have a need to convert a map<string,string> field to string field and vice versa in a hive table. I could not do cast.

I created two external tables with one has string and another map. I can join both to get what I want, takes a long time.

Any ideas of how it can be done efficiently ?

Thanks,

Chalcy

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