hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mohammad Tariq <>
Subject Correct way to use Hive Java API
Date Wed, 05 Jun 2013 06:00:10 GMT
Hello list,

     I am trying to access data stored in my Hive table through the Java
API but looks like I am not using it in the correct manner. Would really
appreciate some help. Here is the small piece of code I am trying to use :

public static void main(String[] args) throws HiveMetaException {
// TODO Auto-generated method stub

Table table = new Table("default", "pokes");
 System.out.println("DBNAME : " + table.getDbName());
List<FieldSchema> cols = new ArrayList<FieldSchema>();
 cols = table.getCols();
System.out.println("SIZE : " + cols.size());
 for(FieldSchema fs : cols) {
System.out.println(fs.getFieldValue(_Fields.findByName("foo VALUE : " +

The problem here is that *table.getCols() *is not returning anything. I
tried to print the size of the list, but it's zero. Looks like i'm missing
out something obvious or the approach itself is wrong. Need some help.
Pardon my ignorance.

Thank you so much for your valuable time.

Warm Regards,

View raw message