Hive开发udf函数打包jar文件后,需将jar文件放入hive的运行环境,方法有三。
先将http://blog.youkuaiyun.com/fjssharpsword/article/details/70265554中重定义的两个类打包成DefTextInputFormat.jar,并放到/home/hdfs目录下。
Added resources: [/home/hdfs/DefTextInputFormat.jar]
查询后文件和表字段一致。
<property>
<name>hive.aux.jars.path</name>
<value>file:///home/hdfs/fangjs/DefTextInputFormat.jar,file:///jarpath/test.jar</value>
</property>
该方法不需要每次启动Hive执行命令加入,需要配置文件。
3、根目录${HIVE_HOME}下创建文件夹auxlib,然后将自定义jar文件放入该文件夹中;
该方法方便快捷,不过对于客户端操作环境就不能执行。
先将http://blog.youkuaiyun.com/fjssharpsword/article/details/70265554中重定义的两个类打包成DefTextInputFormat.jar,并放到/home/hdfs目录下。
1、方法一:使用add jar命令
1)在Hive下执行:add jar /home/hdfs/DefTextInputFormat.jar;
Added [/home/hdfs/DefTextInputFormat.jar] to class pathAdded resources: [/home/hdfs/DefTextInputFormat.jar]
该方法每次启动hive的时候都要从新加入,退出hive就会失效。
查询后文件和表字段一致。
2、hive-site.xml文件配置hive.aux.jars.path:
<property>
<name>hive.aux.jars.path</name>
<value>file:///home/hdfs/fangjs/DefTextInputFormat.jar,file:///jarpath/test.jar</value>
</property>
该方法不需要每次启动Hive执行命令加入,需要配置文件。
3、根目录${HIVE_HOME}下创建文件夹auxlib,然后将自定义jar文件放入该文件夹中;
该方法方便快捷,不过对于客户端操作环境就不能执行。