hive-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edward Capriolo <edlinuxg...@gmail.com>
Subject Re: Do some basic operations on my hive warehouse from java
Date Wed, 19 Oct 2011 21:28:21 GMT
On Wed, Oct 19, 2011 at 5:18 PM, Koert Kuipers <koert@tresata.com> wrote:

> I have the need to do some cleanup on my hive warehouse from java, such as
> deleting tables (both in metastore and the files on hdfs)
>
> I found out how to do this using remote connection:
> org.apache.hadoop.hive.service.HiveClient connects to a hive server with
> only a few lines of code, and it provides simple java methods such a
> drop_table to do my tasks. Neat!
>
> But how do i archieve the same result if i do not want a remote connection
> via hive server, but instead i want to use a direct connection?
>
> Thanks! Koert
>

You have to be careful when you do this. The reason is because the code
below the CLI is not designed direct use. The API can change etc although
they do not change much. That being said I do this :). The way to do it is
you gut the CLI and make a stand alone application.

You can then launch that application with 'hive --service jar /path/to/jar
my.class.name '

An example is a tool I use to generate show create table statments.
https://issues.apache.org/jira/browse/HIVE-967

Or my github project for unit testing hive work.
https://github.com/edwardcapriolo/hive_test

Again, hive was not designed to work this way.

Mime
View raw message