fix: report a negative array_resize size as a user error - #25179
Open
1fanwang wants to merge 3 commits into
Open
fix: report a negative array_resize size as a user error#251791fanwang wants to merge 3 commits into
1fanwang wants to merge 3 commits into
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.93% 81.93% -0.01%
==========================================
Files 1133 1133
Lines 423529 423531 +2
Branches 423529 423531 +2
==========================================
- Hits 347028 347024 -4
- Misses 55910 55914 +4
- Partials 20591 20593 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
nuno-faria
approved these changes
Sep 11, 2026
nuno-faria
left a comment
Contributor
There was a problem hiding this comment.
Thanks @1fanwang, small nit below.
Comment on lines
+191
to
+194
| /// Resolve the requested size for one row. A negative size is rejected as a | ||
| /// user error; reporting it as an internal error asks the caller to file a bug | ||
| /// report for input they control. | ||
| fn resize_count(count_array: &Int64Array, idx: usize) -> Result<usize> { |
Contributor
There was a problem hiding this comment.
I don't think it's necessary to document the past behavior.
Signed-off-by: 1fanwang <1fannnw@gmail.com>
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.