fix: report a negative array_resize size as a user error - #25179
Open
1fanwang wants to merge 1 commit into
Open
Conversation
The size comes from the query, so a negative value is the caller's input, not a broken invariant. Raising an internal error told them to file a bug report for their own argument. Generated-by: GitHub Copilot CLI (Claude Opus 5) Signed-off-by: 1fanwang <1fannnw@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #25179 +/- ##
==========================================
- Coverage 81.91% 81.91% -0.01%
==========================================
Files 1132 1132
Lines 421117 421119 +2
Branches 421117 421119 +2
==========================================
- Hits 344961 344952 -9
- Misses 55767 55775 +8
- Partials 20389 20392 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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?
None; found by sweeping the scalar functions with edge-case arguments.
Rationale for this change
array_resizewith a negative size raises an internal error, which tells thecaller they hit a DataFusion bug and asks them to open a report:
The size is an argument to the query, so a negative value is the caller's input
rather than a broken internal invariant. Sending someone to the issue tracker
for their own argument is misleading, and it hides what was actually wrong.
The behaviour was already meant to be an error.
array_resize.slthas expectedthis call to fail since before this change, but with a bare
query error, sothe internal error satisfied it and went unnoticed.
What changes are included in this PR?
Reject a negative size with an execution error naming the value, which matches
how the neighbouring maximum-size check already reports bad input:
Valid input is untouched:
0still returns[],5still grows to[1, 2, 3, 9, 9], and a NULL size still returns NULL.Are these changes tested?
Yes. The slt file gains the negative case for both
ListandLargeList, plusi64::MINfor the boundary, each pinned to the new message so a regression backto an internal error fails the suite.
The pre-existing
query errorcase for-5still passes, so the contract thata negative size fails is unchanged.
Are there any user-facing changes?
The error for a negative size changes from an internal error to an execution
error with a clear message. No valid call changes behaviour, and no API changes.