fix(function): reject out-of-range power results#25464
Merged
Merged
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
XuPeng-SH
approved these changes
Jul 6, 2026
XuPeng-SH
left a comment
Contributor
There was a problem hiding this comment.
I did not find a blocker in this fix.
The change now rejects non-finite POW/POWER results as out-of-range while preserving normal finite values, NULL propagation, and alias behavior. The added select-list guard also matches the existing FunctionSelectList semantics, so filtered rows no longer evaluate the invalid branch.
heni02
approved these changes
Jul 6, 2026
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.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #25308
What this PR does / why we need it:
Reject non-finite results from
POWandPOWERwith an out-of-range error instead of returningNaNor infinity.The root cause was that the shared
Powerimplementation appended the result of Go'smath.Powwithout checking forNaNor infinity. The implementation now returnsErrOutOfRangefor non-finite results while preserving finite values and NULL handling.Regression coverage includes negative bases with fractional exponents, zero raised to a negative exponent, mixed valid/invalid vectors, and distributed SQL cases for both aliases.
Validation:
go test -count=1 -timeout 120s ./pkg/sql/plan/functiongo test -race -count=1 -timeout 120s -run '^TestPower(OutOfRange)?$' ./pkg/sql/plan/functiongo vet ./pkg/sql/plan/functiongo build ./pkg/sql/plan/functionmo-tester: 53/53 statements passed forfunc_math_power.test