Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Hive deploys the UDF function

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report