UDF reflect is not allowed - Blacklisted
search cancel

UDF reflect is not allowed - Blacklisted

book

Article ID: 294633

calendar_today

Updated On:

Products

Services Suite

Issue/Introduction

Symptoms:
Not able to use reflect function using beeline, but the query works OK with Hvi CLI.

Error Message:

Error while compiling statement: FAILED: SemanticException UDF reflect is not allowed (state=42000,code=40000)

Environment


Cause

When running set hive.server2.builtin.udf.blacklist from beeline, it will return the following as blacklisted:

jdbc:hive2://localhost:10000/default> set hive.server2.builtin.udf.blacklist;
+------------------------------------------------------------------+--+
| set |
+------------------------------------------------------------------+--+
| hive.server2.builtin.udf.blacklist=reflect,reflect2,java_method |
+------------------------------------------------------------------+--+

 

Reflect UDF is blacklisted by default when running queries through HiveServer2 (beeline, ODBC, JDBC connections), as it was found to be a security risk.

The code was modified so if the parameter hive.server2.builtin.udf.blacklist has not been configured or it is blank, its default value will be "reflect,reflect2,java_method".

Resolution

1. Open the Ambari UI

2. Add the custom property in Ambari hive.server2.builtin.udf.blacklist under Hive / Configs / Advanced / Custom hive-site and give it any value, for example "empty_blacklist".

3. Restart services as requested by Ambari.

4. Connect again with beeline and verify that blacklist only includes the dummy value now.

0: jdbc:hive2://localhost:10000/default> set hive.server2.builtin.udf.blacklist;
+-------------------------------------------+--+
| hive.server2.builtin.udf.blacklist=empty_blacklist |
+-------------------------------------------+--+

5. Reflect should work now without issues.