Paul Rogers created DRILL-5331:
----------------------------------
Summary: NPE in FunctionImplementationRegistry.findDrillFunction()
if dynamic UDFs disabled
Key: DRILL-5331
URL: https://issues.apache.org/jira/browse/DRILL-5331
Project: Apache Drill
Issue Type: Bug
Affects Versions: 1.10.0
Reporter: Paul Rogers
Assignee: Paul Rogers
Fix For: 1.11.0
Drill provides the Dynamic UDF (DUDF) functionality. DUFDs can be disabled
using the following option in {{ExecConstants}}:
{code}
String USE_DYNAMIC_UDFS_KEY = "exec.udf.use_dynamic";
BooleanValidator USE_DYNAMIC_UDFS = new
BooleanValidator(USE_DYNAMIC_UDFS_KEY, true);
{code}
In a unit test, we created a setup in which we wish to use only the local
function registry, no DUDF support is needed. Run the code. The following code
is invoked when asking for a non-existent function:
{code}
public DrillFuncHolder findDrillFunction(FunctionResolver functionResolver,
FunctionCall functionCall) {
...
if (holder == null) {
syncWithRemoteRegistry(version.get());
List<DrillFuncHolder> updatedFunctions =
localFunctionRegistry.getMethods(newFunctionName, version);
holder = functionResolver.getBestMatch(updatedFunctions, functionCall);
}
{code}
The result is an NPE:
{code}
ERROR o.a.d.e.e.f.r.RemoteFunctionRegistry - Problem during trying to access
remote function registry [registry]
java.lang.NullPointerException: null
at
org.apache.drill.exec.expr.fn.registry.RemoteFunctionRegistry.getRegistryVersion(RemoteFunctionRegistry.java:119)
~[classes/:na]
{code}
The fix is simply to add a DUDF-enabled check:
{code}
if (holder == null) {
boolean useDynamicUdfs = optionManager != null &&
optionManager.getOption(ExecConstants.USE_DYNAMIC_UDFS);
if (useDynamicUdfs) {
syncWithRemoteRegistry(version.get());
...
{code}
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)