hive UDF添加的方式
1.添加临时函数,只能在此会话中生效,退出hive自动失效
1 hive> add jar /home/jtdata/hiveUDF/out0.jar; 2 Added [/home/jtdata/hiveUDF/out0.jar] to class path 3 Added resources: [/home/jtdata/hiveUDF/out0.jar] 4 5 hive> create temporary function quling as 'com.redhadoop.dataout0.DayOut0'; 6 OK 7 Time taken: 0.135 seconds
2.添加永久函数
1 hadoop-1 ~]# cd $HIVE_HOME 2 3 hadoop-1 hive-client]# mkdir auxlib 4 5 hadoop-1 auxlib]# ls 6 Month.jar out0.jar 7 8 hive> create function quling as 'com.redhadoop.dataout0.DayOut0';
3.添加永久函数
1 hadoop-1 conf]# vim hive-site.xml
在此配置文件中增加配置
<property> <name>hive.aux.jars.path</name> <value>file:///home/hiveUDF/Month.jar,file:///home/hiveUDF/OutZ.jar</value> </property>