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 the return type of coalesce when arg type is DATE (#48032) #48424

Merged
Prev Previous commit
Next Next commit
fix ut
xzhangxian1008 authored and ti-chi-bot committed Nov 8, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 11dff579ad4184497186d4376c50846a2a6bfd4c
4 changes: 3 additions & 1 deletion pkg/expression/builtin_compare.go
Original file line number Diff line number Diff line change
@@ -141,7 +141,9 @@ func (c *coalesceFunctionClass) getFunction(ctx sessionctx.Context, args []Expre
return nil, err
}

bf.tp = resultFieldType
if resultFieldType.GetType() == mysql.TypeDate {
bf.setDecimalAndFlenForDate()
}

bf.tp.AddFlag(resultFieldType.GetFlag())
resultFieldType.SetFlen(0)