Description
The EvaluationContext
exhibits inconsistent behavior when attempting to dereference non-existent constant bindings.
If the user attempts to dereference a non-existent constant reference (which is invalid), the following scenarios may occur:
- If the
EvaluationContext
is empty or contains no constant bindings, theconstantMap
will benull
, and an exception will be thrown. - If the
EvaluationContext
contains some constant bindings (excluding the one being dereferenced), theconstantMap
will not be empty. Attempting to retrieve the non-existent item from it at line154
will returnnull
instead of throwing an exception.
This subtle approach allows certain bugs to be concealed. For instance, there is a bug that prevents the execution of a cached plan containing the like
operator (see #3389). However, this bug only manifests when like
is the only literal in the query. If the query contains any other literal, no exception will be thrown. Instead, the plan cannot be reused because the plan constraint requiring the type of the like
pattern to be String
will always fail since it receives null
from the evaluation context. Consequently, the query will need to be replanned.