Pivotal Knowledge Base

Follow

UDF reflect is not allowed - Blacklisted

Environment

Product Version
 Pivotal HD  3.0.1
 Hive  0.14.0 

Symptom

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)

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.

 

 

Comments

Powered by Zendesk