Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Hive deploys the UDF function

Shulou Source: shulou.com Published: 2022-06-03 02:45:47 10月02日 Update

I. Temporarily adding UDF functions

1. Upload jar package to hive server

2. The hive shell executes the following command:

add jar /home/hive/hivejar/billing-on-hive-1.0.jarcreate temporary function strip as 'com.tsingzone.bigdata.billing. GetOperator'; Note: strip: custom function name com.tsingzone.bigdata.billing.GetOperator: class name only valid for current shell

3. How to use:

select strip(dest_termi_id) from huadan201601 limit 10;

II. Permanently adding UDFs

1. Upload jar package to hdfs

hdfs dfs -put hivejar/billing-on-hive-1.0.jar /user/hive/hive_jar

2. create functions

create function billing as 'com.tsingzone.bigdata.billing.GetOperator' using jar 'hdfs:///user/hive/hive_jar/billing-on-hive-1.0.jar'

3. use

hive -S -e "select billing(dest_termi_id) from huadan201601 limit 10;"

Reference: blog.csdn.net/liam08/article/details/51311772

Tags: Function usage command document method server class name permanent reference service Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Tech Info Docker Linux Shulou Technology