Help Center/ MapReduce Service/ Troubleshooting/ Using Hive/ An Error Is Reported When a UDF Is Created on the Beeline Client
Updated on 2023-11-30 GMT+08:00

An Error Is Reported When a UDF Is Created on the Beeline Client

Symptom

Run the following command:

create function fn_test3 as 'test.MyUDF' using jar 'hdfs:///tmp/udf2/MyUDF.jar'

The following error is reported:

Error: Error while compiling statement: FAILED: HiveAccessControlException Permission denied: Principal [name=admin, type=USER] does not have following privileges for operation CREATEFUNCTION [[ADMIN PRIVILEGE] on Object [type=DATABASE, name=default], [ADMIN PRIVILEGE] on Object [type=FUNCTION, name=default.fn_test3]] (state=42000,code=40000)

Cause Analysis

To create a permanent function in Hive, role admin is required.

Solution

Run the set role admin command before running the statement.