Hive add third-party jar such as HDF

Source: Internet
Author: User
Tags types of functions

Hive supports custom implementation of SQL functions in Java code, with the following steps

1: Inherit UDF, implement function evaluate, parameter return value can be overloaded

2:jdbc:hive2://ht03:10000/default> Add Jar/opt/hive-udf/udf-str.jar

3:create temporary FUNCTION tostring as ' Com.htdc.etl.server.demo.UDFDemo ';

4:select Demo (' 1 ', ' 2 ') from car limit 1;

PS: The above-mentioned way to create a function is a temporary function, in the current session is valid, so in code execution, you must first execute the above 2, 32 lines of command, hive itself does not support the permanent function, most of the internet to change the source of the way to implement.

There are altogether three types of functions:

A:UDF multi-line to row, peer operation

B:UDTF (user-defined table-generating Functions) is used to resolve the need to enter multiple lines of output (On-to-many maping) on one line.

C:UDAF-Aggregation function

Hive add third-party jar such as HDF

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.