1.臨時註冊
1.導入jar包
2.部署到hive的lib下。
3.添加jar到hive的classpath
$hive>add jar app-logs-hive-1.0-SNAPSHOT.jar ;
4.註冊臨時函數
$hive>create temporary function helloworld AS 'com.it.applogs.udf.DayStartUDF';
2.刪除註冊函數
drop temporary function helloworld;
3.永久註冊函數
create function helloword as 'com.it.applogs.udf.DayStartUDF' using jar 'hdfs:/jars/hive-functions-0.0.1.jar';
注意:永久註冊需要將jar包上傳到hdfs,否則在集羣中運行的時候,會出現找不到jar包的情況!