Repository navigation
add SIGN - #24650
add SIGN#24650
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
left a comment
There was a problem hiding this comment.
I found one blocking correctness issue in the current SIGN() registration.
SIGN is wired with fixedTypeMatch and overloads for int64, uint64, float64, decimal64, and decimal128 only. For char/varchar inputs, the implicit-cast rules prefer int64 over float64 (type_check.go: varchar -> int64 has lower cost than varchar -> float64), so string arguments resolve to the integer overload.
That makes fractional numeric strings behave incorrectly. For example, SIGN('0.5'), SIGN('-0.3'), and SIGN('123.123') will not take the float path; they go through string->int casting instead (func_cast.go uses strconv.ParseInt for that path), which is MySQL-incompatible and can return the wrong result or an invalid-arg error instead of 1 / -1.
So the overload set / matcher still needs adjustment before approval, and the SQL tests should cover string inputs like SIGN('0.5'), SIGN('-0.3'), and SIGN('123.123').
Merge Queue Status
This pull request spent 28 minutes 22 seconds in the queue, with no time running CI. ReasonThe pull request can't be updated
HintYou should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again. |
What type of PR is this?
Which issue(s) this PR fixes:
issue ##24481
What this PR does / why we need it:
增加sign函数. 判断数字的符号位