On Wed, Oct 19, 2011 at 5:18 PM, Koert Kuipers <ko...@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.