diff --git a/expression/builtin_time_vec_generated.go b/expression/builtin_time_vec_generated.go index 9c0f181bbfc8f..87a89e8208cc6 100644 --- a/expression/builtin_time_vec_generated.go +++ b/expression/builtin_time_vec_generated.go @@ -746,8 +746,8 @@ func (b *builtinSubDatetimeAndStringSig) vecEvalTime(input *chunk.Chunk, result } return err } - output, err := arg0.Add(sc, arg1Duration.Neg()) + if err != nil { return err } diff --git a/expression/generator/time_vec.go b/expression/generator/time_vec.go index 86a8f6703d8d8..5d18b9a4a17b4 100644 --- a/expression/generator/time_vec.go +++ b/expression/generator/time_vec.go @@ -175,12 +175,7 @@ func (b *{{.SigName}}) vecEval{{ .Output.TypeName }}(input *chunk.Chunk, result {{ else }} sc := b.ctx.GetSessionVars().StmtCtx arg1Duration := types.Duration{Duration: arg1, Fsp: -1} - arg1time, err := arg1Duration.ConvertToTime(sc, mysql.TypeDatetime) - if err != nil { - return err - } - tmpDuration := arg0.Sub(sc, &arg1time) - output, err := tmpDuration.ConvertToTime(sc, arg0.Type()) + output, err := arg0.Add(sc, arg1Duration.Neg()) {{ end }} if err != nil { return err @@ -205,12 +200,7 @@ func (b *{{.SigName}}) vecEval{{ .Output.TypeName }}(input *chunk.Chunk, result } return err } - arg1time, err := arg1Duration.ConvertToTime(sc, mysql.TypeDatetime) - if err != nil { - return err - } - tmpDuration := arg0.Sub(sc, &arg1time) - output, err := tmpDuration.ConvertToTime(sc, mysql.TypeDatetime) + output, err := arg0.Add(sc, arg1Duration.Neg()) {{ end }} if err != nil { return err