Prevent array_position panic for minimum start positions - #24838
Merged
Conversation
The one-based start offset accepts any Int64 input. Subtracting one from i64::MIN currently panics in debug builds instead of returning a normal execution error. Generated-by: GitHub Copilot CLI (GPT-5.6 Sol) Signed-off-by: 1fanwang <1fannnw@gmail.com>
comphead
reviewed
Sep 1, 2026
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24838 +/- ##
==========================================
+ Coverage 81.58% 81.61% +0.03%
==========================================
Files 1123 1123
Lines 406743 409401 +2658
Branches 406743 409401 +2658
==========================================
+ Hits 331840 334152 +2312
- Misses 55464 55629 +165
- Partials 19439 19620 +181 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The overflow error named the rejected value but not what the function would have accepted, so a reader could not tell which inputs are valid. Generated-by: GitHub Copilot CLI (Claude Opus 5) Signed-off-by: 1fanwang <1fannnw@gmail.com>
jayzhan211
approved these changes
Sep 2, 2026
jayzhan211
left a comment
Contributor
There was a problem hiding this comment.
Thanks @1fanwang , LGTM
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?
Rationale for this change
array_positionaccepts an optional one-based start position. Passing-9223372036854775808currently aborts evaluation with:It now returns the normal execution error
start_from out of bounds: -9223372036854775808.What changes are included in this PR?
The one-based-to-zero-based conversion now uses checked subtraction in both optimized and generic execution paths.
What is the testing strategy for this PR?
SQL regressions exercise a scalar start position, a column start position with a scalar needle, and column start and needle values.
Raw results
Are there any user-facing changes?
Yes. An invalid minimum
Int64start position returns an execution error instead of panicking.