hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashish Thusoo <athu...@facebook.com>
Subject RE: Complex Type and JDBC
Date Thu, 20 Aug 2009 18:18:23 GMT
JDBC itself does not support complex types. If I remember correctly (Raghu can confirm), the
complex type should get serialzed as a json string when you run the query. You can then do
a res.getString(2) to get that column and then use some json libraries in java to deserialize
this and get back a java map.

Ashish

________________________________
From: michal shmueli [mailto:michal.shmueli@gmail.com]
Sent: Thursday, August 20, 2009 3:01 AM
To: hive-user@hadoop.apache.org
Subject: Complex Type and JDBC

Folks,

I have a table with this schema: (int key, values MAP<String, String>). I want to fetch
the data from the table into local Map in my java code.
Following the hive JDBC example, I did :
String selectSql = "select * from " + tableName;
ResultSet res = stmt.executeQuery(selectSql);

To get the first attribute (the key ) i did: String user = res.getString(1);
Now I wish to get the data of values (the Map) into the local map, but I don't know how to
access the ResultSet such that it will keep the Map so i don't have to parse the content.
Is there such an option at all? if not, does it mean that I can only keep the complex type
within Hive and can't utilize it to other parts?

thanks,
Michal

Mime
View raw message