#17982 Make nvl
a thin wrapper for coalesce
#17991
Open
+105
−208
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
nvl
#17982Rationale for this change
By making
NVLFunc
a wrapper forCoalesceFunc
with a more restrictive signature the implementation automatically benefits from any optimisation work related tocoalesce
.What changes are included in this PR?
NVLFunc
a thin wrapper ofCoalesceFunc
. This seemed like the simplest way to reuse the coalesce logic, but keep the stricter signature ofnvl
.ScalarUDF::conditional_arguments
as a more precise complement toScalarUDF::short_circuits
. By letting each function expose which arguments are eager and which are lazy, we provide more precise information to the optimizer which may enable better optimisation.Are these changes tested?
Assumed to be covered by sql logic tests.
Unit tests for the custom implementation were removed since those are no longer relevant.
Are there any user-facing changes?
The rewriting of
nvl
tocase when ... then ... else ... end
is visible in the physical query plan.