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