You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
func (a*baseFuncDesc) typeInfer4MaxMin(ctx sessionctx.Context) {
_, argIsScalaFunc:=a.Args[0].(*expression.ScalarFunction)
ifargIsScalaFunc&&a.Args[0].GetType().Tp==mysql.TypeFloat {
// For scalar function, the result of "float32" is set to the "float64"// field in the "Datum". If we do not wrap a cast-as-double function on a.Args[0],// error would happen when extracting the evaluation of a.Args[0] to a ProjectionExec.tp:=types.NewFieldType(mysql.TypeDouble)
tp.Flen, tp.Decimal=mysql.MaxRealWidth, types.UnspecifiedLengthtypes.SetBinChsClnFlag(tp)
a.Args[0] =expression.BuildCastFunction(ctx, a.Args[0], tp)
}
a.RetTp=a.Args[0].GetType() // We should call a.Args[0].GetType().Clone() and reset the `NotNullFlag` for max/min in this line.ifa.RetTp.Tp==mysql.TypeEnum||a.RetTp.Tp==mysql.TypeSet {
a.RetTp=&types.FieldType{Tp: mysql.TypeString, Flen: mysql.MaxFieldCharLength}
}
}
Bug Report
Please answer these questions before submitting your issue. Thanks!
If possible, provide a recipe for reproducing the error.
What did you expect to see?
0
What did you see instead?
NULL
What version of TiDB are you using (
tidb-server -V
or runselect tidb_version();
on TiDB)?current master branch build
The text was updated successfully, but these errors were encountered: