You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hive.apache.org by Dilip Joseph <di...@gmail.com> on 2010/04/12 05:39:30 UTC
Support for lists in JDBC client?
Does the Hive JDBC client support lists and structs in the ResultSet?
I am getting an array of nulls when I try to do a SELECT * on the
following table from a JDBC client written in Jython.
CREATE TABLE pokes (
key INT,
vals ARRAY<INT>
);
Works fine from the command line
$ hive -e "SELECT * from pokes"
OK
1 [2,3]
10 [11,12,13]
Jython program:
from java.lang import *
from java.sql import *
driverName = "org.apache.hadoop.hive.jdbc.HiveDriver";
try:
Class.forName(driverName);
except Exception, e:
print "Unable to load %s" % driverName
System.exit(1);
conn = DriverManager.getConnection("jdbc:hive://");
stmt = conn.createStatement();
query_str = "SELECT * from pokes"
res = stmt.executeQuery(query_str);
while res.next():
key = res.getInt(1)
vals = res.getObject(2)
print key, vals
Output of running the Jython program (only tail shown):
10/04/11 20:29:50 INFO ql.Driver: Starting command: SELECT * from pokes
OK
10/04/11 20:29:50 INFO ql.Driver: OK
10/04/11 20:29:50 INFO ql.Driver: Returning Thrift schema:
Schema(fieldSchemas:[FieldSchema(name:key, type:i32, comment:null),
FieldSchema(name:vals, type:list<i32>, comment:null)],
properties:null)
10/04/11 20:29:50 INFO service.HiveServer: Returning schema:
Schema(fieldSchemas:[FieldSchema(name:key, type:i32, comment:null),
FieldSchema(name:vals, type:list<i32>, comment:null)],
properties:null)
10/04/11 20:29:50 INFO mapred.FileInputFormat: Total input paths to process : 1
1 [null]
10 [null]
The output arrays above contain just "null".
Am I missing some step here?
Thanks,
Dilip