drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Paul Rogers (JIRA)" <j...@apache.org>
Subject [jira] [Created] (DRILL-5330) NPE in FunctionImplementationRegistry.functionReplacement()
Date Wed, 08 Mar 2017 00:26:37 GMT
Paul Rogers created DRILL-5330:

             Summary: NPE in FunctionImplementationRegistry.functionReplacement()
                 Key: DRILL-5330
                 URL: https://issues.apache.org/jira/browse/DRILL-5330
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.10.0
            Reporter: Paul Rogers
            Assignee: Paul Rogers
             Fix For: 1.11.0

The code in {{FunctionImplementationRegistry.functionReplacement()}} will produce an NPE if
ever it is called:

          if (optionManager != null
              && optionManager.getOption(

If an option manager is provided, then get the specified option. The option manager will contain
a value for that option only if the user has explicitly set that option. Suppose the user
had not set the option. Then the return from {{getOption()}} will be null.

The next thing we do is *assume* that the option exists and is a boolean by dereferencing
the option. This will trigger an NPE. This NPE was seen in detail-level unit tests.

The proper way to handle such options is to use an option validator. Strangely, one actually
exists in {{ExecConstants}}:

  String CAST_TO_NULLABLE_NUMERIC = "drill.exec.functions.cast_empty_string_to_null";

Then do:


This message was sent by Atlassian JIRA

View raw message