expression: incompatibility with MySQL for ADDTIME()#21401
Conversation
671470c to
be29d7e
Compare
|
There is no reward for this challenge pull request, so you can request a reward from @SunRunAway. |
|
@qw4990 PTAL |
There was a problem hiding this comment.
The file is generated by go generate in expression/generator. We shouldn't edit it by manual.. Maybe we should modify the template in time_vec.go and run make gogenerate to generate the code.
There was a problem hiding this comment.
If the reason is the same, I think we can fix it in this pr.
|
Test case fails |
| if isNull || err != nil { | ||
| return "", isNull, err | ||
| } | ||
| if !isDuration(arg1Str) { |
There was a problem hiding this comment.
Test case fails
[2021-08-12T09:34:14.503Z] FAIL: builtin_time_test.go:903: testEvaluatorSuite.TestAddTimeSig [2021-08-12T09:34:14.503Z] [2021-08-12T09:34:14.503Z] builtin_time_test.go:1012: [2021-08-12T09:34:14.503Z] c.Assert(len(warnings), Equals, i+1+beforeWarnCnt) [2021-08-12T09:34:14.503Z] ... obtained int = 8 [2021-08-12T09:34:14.503Z] ... expected int = 9 [2021-08-12T09:34:14.503Z]
Here is the reason, if arg1Str is not a MySQL Time, it just return without error.
| return "", true, nil | ||
| } | ||
| sc := b.ctx.GetSessionVars().StmtCtx | ||
| arg1, err = types.ParseDuration(sc, arg1Str, getFsp4TimeAddSub(arg1Str)) |
There was a problem hiding this comment.
I don't think so. MySQL also doesn't throw a error/warning.
There was a problem hiding this comment.
It's make sense. Should we remove those two test cases(below)? Or we should throw a error/warning inside func (b *builtinAddStringAndStringSig) evalString(row chunk.Row)?
What problem does this PR solve?
Issue Number: close #19150
What is changed and how it works?
What's Changed:
builtinAddStringStringSigeval/vecEval return null whenarg1isn'tDurationtype (eg:ADDTIME('2020-05-13 14:01:24', '2020-04-29 05:11:19'))How it Works:
make
builtinAddStringStringSigreturn null whenarg1isn'tDurationtype (eg:ADDTIME('2020-05-13 14:01:24', '2020-04-29 05:11:19'))Related changes
Tests
Side effects
Release note