Skip to content

Commit

Permalink
cherry pick pingcap#20233 to release-3.0
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
Ling Jin authored and ti-srebot committed Dec 18, 2020
1 parent 9ab0bbf commit 8a23d09
Show file tree
Hide file tree
Showing 5 changed files with 2,000 additions and 0 deletions.
10 changes: 10 additions & 0 deletions expression/builtin_cast.go
Original file line number Diff line number Diff line change
Expand Up @@ -549,7 +549,17 @@ func (b *builtinCastIntAsTimeSig) evalTime(row chunk.Row) (res types.Time, isNul
if isNull || err != nil {
return res, isNull, err
}
<<<<<<< HEAD
res, err = types.ParseTimeFromNum(b.ctx.GetSessionVars().StmtCtx, val, b.tp.Tp, b.tp.Decimal)
=======

if b.args[0].GetType().Tp == mysql.TypeYear {
res, err = types.ParseTimeFromYear(b.ctx.GetSessionVars().StmtCtx, val)
} else {
res, err = types.ParseTimeFromNum(b.ctx.GetSessionVars().StmtCtx, val, b.tp.Tp, int8(b.tp.Decimal))
}

>>>>>>> b232a23e7... expression, types: fix datetime and year comparison error (#20233)
if err != nil {
return types.Time{}, true, handleInvalidTimeError(b.ctx, err)
}
Expand Down
Loading

0 comments on commit 8a23d09

Please sign in to comment.