-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expression: fix out of range error for intdiv #7492
Conversation
@zz-jason PTAL |
Thanks @mccxj ! |
expression/builtin_arithmetic.go
Outdated
func (s *builtinArithmeticIntDivideDecimalSig) evalInt(row chunk.Row) (ret int64, isNull bool, err error) { | ||
sc := s.ctx.GetSessionVars().StmtCtx | ||
var num [2]*types.MyDecimal | ||
for i, arg := range s.args[0:2] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we return an error if len(args) is not 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
argument validation should not be done in this phase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So use s.args
is also safe here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh, I forgot it. use s.args is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@jackysp PTAL |
/run-all-tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
What problem does this PR solve?
#4477
What is changed and how it works?
see https://github.com/mysql/mysql-server/blob/913071c0b16cc03e703308250d795bc381627e37/sql/item_func.cc#L2232
mysql's behavior:
Check List
Tests
Code changes
Side effects
Related changes