Hadoop Hive - 如何'添加jar'以用于Hive JDBC客户端? [英] Hadoop Hive - How can I 'add jar' for use with the Hive JDBC client?

查看:368
本文介绍了Hadoop Hive - 如何'添加jar'以用于Hive JDBC客户端?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我有hdfs和hive一起工作。我也有用于Hive功能的jdbc驱动程序,以便可以进行远程jdbc调用。



现在,我添加了Hive用户定义函数(UDF)。它在CLI中效果很好......我甚至通过.hiverc文件自动加载jar和相关函数。但是,我无法使用配置单元jdbc驱动程序来使用它。我认为它也会使用.hiverc文件(默认情况下,位于/ usr / lib / hive / bin /中),但它似乎不起作用。我也试着通过'add jar'SQL命令添加它作为第一件事,但无论我把jar文件放在哪里,我都会在hive.log中发现该文件找不到的错误。



任何人都知道如何做到这一点?我使用的是Cloudera Distribution(CDH3u2),它使用Hive-0.7.1。



感谢您提前。

解决方案

我也使用JDBC驱动程序连接到Hive。我scp我的jar到集群的主节点上,这也是Hive的安装位置,然后在我的add jar命令中使用文件的绝对路径(在主节点上)。我通过JDBC驱动程序发出add jar命令,就像任何其他HQL命令一样。


So, I have hdfs and hive working together. I also have the jdbc driver for Hive functioning so that I can make remote jdbc calls.

Now, I have added a Hive User Defined Function (UDF). It works great in the CLI... I even load the jar and associated function automatically via the .hiverc file. However, I cannot get this to work using the hive jdbc driver. I thought it would also use the .hiverc file (by default, located in /usr/lib/hive/bin/), but it does not seem to work. I also tried adding it via an 'add jar' SQL command as the first thing, but no matter where I put the jar file, I get an error in hive.log that the file cannot be found.

Anyone know how to do this? I am using the Cloudera Distribution (CDH3u2), which uses Hive-0.7.1.

Thanks, in advance.

解决方案

I use JDBC driver to connect to Hive as well. I scp my jar onto the master node of the cluster, which is also where Hive is installed and then use the absolute path to the file (on the master node) in my add jar command. I issue the add jar command via the JDBC driver just like any other HQL command.

这篇关于Hadoop Hive - 如何'添加jar'以用于Hive JDBC客户端?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆