



Information | Description(Optional) |
Function Type | Create functions according to their nature under the preset function categories, which include: analytical functions, encryption functions, aggregate functions, logical functions, date and time functions, math functions, conversion functions, string functions, IP and domain name functions, window functions, and other functions. |
Class Name | Enter the class name of the function. |
Function file | Select the address of the function source file: Select resource file: Select the function file from the jar or zip resources uploaded through the resource management feature. Specify COS path: Obtain the function file from the platform COS bucket path. |
Resource file | The function file option is Select Resource File, which requires selecting the required function file in the resource management directory. |
COS Path | The function file option is Specify COS Path; you need to enter the path of the function file in the platform COS bucket. |
Command Format | The format is: function name(parameter). For example, the command format of the sum function is sum(col). |
Usage Instructions | Instructions for Custom Functions. For example, the usage instructions for the sum function are: Calculate the summarized value. |
Parameter Description | Parameter Description of Custom Functions. For example, the parameter description for the sum function is: col: required. The column value can be of type DOUBLE, DECIMAL, or BIGINT. If the input is of type STRING, it will be implicitly converted to DOUBLE type before participating in the calculation. |
Return Value | Description of the return value of custom functions. For example, the return value of the sum function is: Returns DOUBLE type. |
Example | Example description of custom functions. For example, the example for the sum function is: Calculate the total sales amount of all products, the command example is: select sum(sales) from table. |

mvn archetype:generate -DgroupId=com.example -DartifactId=demo-hive -Dveriosn=1.0-SNAPSHOT -Dpackage=com.example

<dependencies><dependency><groupId>org.apache.hive</groupId><artifactId>hive-exec</artifactId><version>2.3.8</version><exclusions><exclusion><groupId>org.pentaho</groupId><artifactId>pentaho-aggdesigner-algorithm</artifactId></exclusion><exclusion><groupId>javax.servlet</groupId><artifactId>servlet-api</artifactId></exclusion><exclusion><groupId>org.eclipse.jetty.orbit</groupId><artifactId>javax.servlet</artifactId></exclusion></exclusions></dependency><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.11</version><scope>test</scope></dependency></dependencies>
package com.example;import org.apache.hadoop.hive.ql.exec.UDF;public class UppercaseUDF extends UDF {public String evaluate(String input) {return input.toUpperCase();}}
<build><plugins><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>3.8.1</version><configuration><source>1.8</source><target>1.8</target></configuration></plugin><!--(start) for package jar with dependencies --><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-assembly-plugin</artifactId><version>3.0.0</version><configuration><archive><!--Specify the class containing the main method--><manifest><mainClass>com.example.UppercaseUDF</mainClass></manifest></archive><!--Cannot modify jar-with-dependencies--><descriptorRefs><descriptorRef>jar-with-dependencies</descriptorRef></descriptorRefs><appendAssemblyId>false</appendAssemblyId></configuration><executions><execution><id>make-assembly</id> <!-- this is used for inheritance merges --><phase>package</phase> <!-- bind to the packaging phase --><goals><goal>single</goal></goals></execution></executions></plugin><!--(end) for package jar with dependencies --></plugins></build><repositories><repository><id>alimaven</id><name>aliyun maven</name><url>http://maven.aliyun.com/nexus/content/groups/public/</url></repository></repositories>
mvn package -Dmaven.test.skip=true


Information | Content |
Function Type | Other functions |
Class Name | com.example.UppercaseUDF |
Function file | Select a resource file |
Resource file | demo-hive-1.0-SNAPSHOT.jar |
Command Format | UppercaseUDF(col) |
Usage Instructions | Convert the input string to uppercase format |
Parameter Description | Input parameter of string type |
Return Value | Output the uppercase form of a string |

Feedback