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: fix that str_to_date returns different result on no zero date sql mode. (#39316) #39355

Closed
Show file tree
Hide file tree
Changes from all 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
5 changes: 4 additions & 1 deletion expression/builtin_time_vec.go
Original file line number Diff line number Diff line change
Expand Up @@ -1133,7 +1133,6 @@ func (b *builtinStrToDateDurationSig) vecEvalDuration(input *chunk.Chunk, result
result.MergeNulls(bufStrings, bufFormats)
d64s := result.GoDurations()
sc := b.ctx.GetSessionVars().StmtCtx
hasNoZeroDateMode := b.ctx.GetSessionVars().SQLMode.HasNoZeroDateMode()
for i := 0; i < n; i++ {
if result.IsNull(i) {
continue
Expand All @@ -1147,6 +1146,7 @@ func (b *builtinStrToDateDurationSig) vecEvalDuration(input *chunk.Chunk, result
result.SetNull(i, true)
continue
}
<<<<<<< HEAD
if hasNoZeroDateMode && (t.Year() == 0 || t.Month() == 0 || t.Day() == 0) {
if err := handleInvalidTimeError(b.ctx, types.ErrWrongValue.GenWithStackByArgs(types.DateTimeStr, t.String())); err != nil {
return err
Expand All @@ -1155,6 +1155,9 @@ func (b *builtinStrToDateDurationSig) vecEvalDuration(input *chunk.Chunk, result
continue
}
t.SetFsp(int8(b.tp.Decimal))
=======
t.SetFsp(b.tp.GetDecimal())
>>>>>>> 7930c2ce7b (expression: fix that str_to_date returns different result on no zero date sql mode. (#39316))
dur, err := t.ConvertToDuration()
if err != nil {
return err
Expand Down
Loading