Skip to content
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: compatibility is changed #30653

Merged
merged 7 commits into from
Jan 5, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions expression/builtin_time.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ import (
"github.com/pingcap/tidb/types"
"github.com/pingcap/tidb/util/chunk"
"github.com/pingcap/tidb/util/logutil"
"github.com/pingcap/tidb/util/parser"
"github.com/pingcap/tipb/go-tipb"
"github.com/tikv/client-go/v2/oracle"
"go.uber.org/zap"
Expand Down Expand Up @@ -5556,6 +5557,13 @@ func (b *builtinAddStringAndStringSig) evalString(row chunk.Row) (result string,
}
return "", true, err
}

check := arg1Str
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be useful to add a comment here about why this is needed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, In fact I think add the code in func isDuration or create a new func maybeErrDuration may be butter, but isDuration is a util func, I'm afraid to get new wrong, so I add the code here. I may add some cmment or create a new func, but which file may i add the func?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will check the other concor case and try to solve them

_, check, _ = parser.Number(parser.Space0(check))
check, err = parser.Char(check, '-')
if strings.Compare(check, "") != 0 && err == nil {
return "", true, nil
}
if isDuration(arg0) {
result, err = strDurationAddDuration(sc, arg0, arg1)
if err != nil {
Expand Down
1 change: 1 addition & 0 deletions expression/builtin_time_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ func TestAddTimeSig(t *testing.T) {
{"2018-08-16 20:21:01", "00:00:00.000001", "2018-08-16 20:21:01.000001"},
{"1", "xxcvadfgasd", ""},
{"xxcvadfgasd", "1", ""},
{"2020-05-13 14:01:24", "2020-04-29 05:11:19", ""},
}
fc := funcs[ast.AddTime]
for _, c := range tbl {
Expand Down