Repository navigation
Conversation
Signed-off-by: 1fanwang <1fannnw@gmail.com>
coalesce rejects some pairs that nvl accepted, such as an integer and a boolean, and resolves others differently. Arguments of the types the original signature listed keep its coercion, and coalesce coercion only applies to other types, falling back to the original when it fails. Signed-off-by: 1fanwang <1fannnw@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25964 +/- ##
==========================================
+ Coverage 82.59% 82.61% +0.01%
==========================================
Files 1145 1145
Lines 444096 444350 +254
Branches 444096 444350 +254
==========================================
+ Hits 366806 367083 +277
+ Misses 55021 54977 -44
- Partials 22269 22290 +21 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Oct 13, 2026
adriangb
approved these changes
Oct 17, 2026
Contributor
Signed-off-by: 1fanwang <1fannnw@gmail.com>
Contributor
Author
Contributor
|
Thanks @1fanwang ! |
adriangb
enabled auto-merge
October 20, 2026 22:45
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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/ifnullconvert decimals to Float64 and timestamps and dates to strings #25947.Rationale for this change
nvl and ifnull lose decimal digits and convert dates and timestamps to strings, unlike coalesce. That also breaks timestamp arithmetic after ifnull. Their signature omits these types, so the planner coerces them to numbers or strings.
What changes are included in this PR?
The planner uses coalesce's type union for those types and retains existing coercion for primitive arguments and unsupported unions. This preserves accepted integer/boolean calls but also retains mixed-integer Float32 rounding. The shared helper validates argument counts; evaluation is unchanged.
What is the testing strategy for this PR?
SQL regressions cover decimal values, date and timestamp types, timestamp arithmetic and compatibility pairs. The public UDF and SQL tests also cover wrong argument counts.
Testing Done
datafusion-cli built with cargo build --profile ci -p datafusion-cli on main (416002a) and on this branch, running the issue's queries:
On main, nvl returns Float64 for the decimals and Utf8View for the timestamp and date, and the interval addition fails:
For these decimal, date and timestamp queries, nvl and ifnull retain the values and types, and timestamp arithmetic succeeds:
Argument types the signature already listed keep their result types, including pairs coalesce rejects or resolves differently, and a timestamp with a string still falls back to the original coercion:
On main:
On this branch:
The argument-count regressions now use the standard message:
target/ci/datafusion-cli -q --format json -c 'SELECT nvl(1);'Reproducer source: datafusion-25947.sql
Reproducer source: nvl-kept-types.sql
Are there any user-facing changes?
Yes. Decimal, date and timestamp results retain their types; existing primitive-type coercion remains unchanged.