Error while compiling statement: FAILED: SemanticException UDF reflect is not allowed (state=42000,code=40000)
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".
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.