Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Threaded View
Hive >> mail # user >> Correct way to use Hive Java API


Copy link to this message
-
Re: Correct way to use Hive Java API
Hello Prasad,

    Thank you for the reply. I was actually trying to achieve this without
JDBC. Is it possible by any means?

Thanks again.

On Friday, June 7, 2013, Prasad Mujumdar <[EMAIL PROTECTED]> wrote:
>
>    I think the new Table("default", "pokes")will create a dummy table
object with only the db name and table name set. It will not retrieve the
table information from metastore.
> If you are looking for the schema information and retrieve the data, you
might want to consider using the JDBC interface. The JDBC driver can be
used with a remote hiveserver as well embedded hive.
> thanks
> Prasad
>
>
>
> On Fri, Jun 7, 2013 at 7:59 AM, Haidar Hadi <[EMAIL PROTECTED]>
wrote:
>>
>> Hello all,
>> I have similar issue, any idea?
>>
>> On Jun 4, 2013, at 11:00 PM, Mohammad Tariq <[EMAIL PROTECTED]> wrote:
>>
>> 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 : " +
"foo")));
>> }
>> }
>> 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,
>> Tariq
>> cloudfront.blogspot.com
>
>

--
Warm Regards,
Tariq
cloudfront.blogspot.com