Stamatis Zampetakis created HIVE-29443:
------------------------------------------
Summary: NPE in FunctionRegistry#getFunctionInfo when session not
available
Key: HIVE-29443
URL: https://issues.apache.org/jira/browse/HIVE-29443
Project: Hive
Issue Type: Bug
Components: HiveServer2
Reporter: Stamatis Zampetakis
Assignee: Stamatis Zampetakis
Various methods in FunctionRegistry fail with a NullPointerException when a
session is not available and they attempt to perform a qualified lookup using
the name of the current database.
{noformat}
java.lang.NullPointerException: Cannot invoke
"org.apache.hadoop.hive.ql.session.SessionState.getCurrentDatabase()" because
the return value of "org.apache.hadoop.hive.ql.session.SessionState.get()" is
null
at
org.apache.hadoop.hive.ql.exec.Registry.getFunctionInfo(Registry.java:371)
at
org.apache.hadoop.hive.ql.exec.FunctionRegistry.getFunctionInfo(FunctionRegistry.java:826)
{noformat}
Instead of failing with a NPE it is better to perform the lookup in the
"default" database and return null if no function is found. This also reduces
the coupling of the FunctionRegistry with the Session allowing to be used in
other use-cases as well.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)