hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Grover <mgro...@oanda.com>
Subject Re: hive map field question
Date Wed, 23 Nov 2011 16:25:35 GMT
Chalcy,
I don't know of an existing UDF that lists all keys and values of a map. You may want to check
ql/src/java/org/apache/hadoop/hive/ql/udf in Hive source to double check.
But, as you might have guessed, it'd be pretty straightforward to do that in your own UDF:-)

Mark

----- Original Message -----
From: "Chalcy Raja" <Chalcy.Raja@careerbuilder.com>
To: "user@hive.apache.org" <user@hive.apache.org>
Sent: Wednesday, November 23, 2011 11:14:09 AM
Subject: 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:mgrover@oanda.com] 
Sent: Wednesday, November 23, 2011 11:01 AM
To: user@hive.apache.org
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" <Chalcy.Raja@careerbuilder.com>
To: user@hive.apache.org
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 


Mime
View raw message