diff --git a/expression/builtin_op.go b/expression/builtin_op.go index c51f88669b82a..fae7163fc7f3e 100644 --- a/expression/builtin_op.go +++ b/expression/builtin_op.go @@ -173,6 +173,14 @@ func (c *logicXorFunctionClass) getFunction(ctx sessionctx.Context, args []Expre if err != nil { return nil, err } + args[0], err = wrapWithIsTrue(ctx, true, args[0]) + if err != nil { + return nil, errors.Trace(err) + } + args[1], err = wrapWithIsTrue(ctx, true, args[1]) + if err != nil { + return nil, errors.Trace(err) + } bf := newBaseBuiltinFuncWithTp(ctx, args, types.ETInt, types.ETInt, types.ETInt) sig := &builtinLogicXorSig{bf} diff --git a/expression/builtin_op_test.go b/expression/builtin_op_test.go index 24e3f48946190..3b74faca29252 100644 --- a/expression/builtin_op_test.go +++ b/expression/builtin_op_test.go @@ -613,13 +613,13 @@ func (s *testEvaluatorSuite) TestLogicXor(c *C) { {[]interface{}{0, nil}, 0, true, false}, {[]interface{}{nil, 0}, 0, true, false}, {[]interface{}{nil, 1}, 0, true, false}, - {[]interface{}{0.5000, 0.4999}, 1, false, false}, + {[]interface{}{0.5000, 0.4999}, 0, false, false}, {[]interface{}{0.5000, 1.0}, 0, false, false}, - {[]interface{}{0.4999, 1.0}, 1, false, false}, + {[]interface{}{0.4999, 1.0}, 0, false, false}, {[]interface{}{nil, 0.000}, 0, true, false}, {[]interface{}{nil, 0.001}, 0, true, false}, {[]interface{}{types.NewDecFromStringForTest("0.000001"), 0.00001}, 0, false, false}, - {[]interface{}{types.NewDecFromStringForTest("0.000001"), 1}, 1, false, false}, + {[]interface{}{types.NewDecFromStringForTest("0.000001"), 1}, 0, false, false}, {[]interface{}{types.NewDecFromStringForTest("0.000000"), nil}, 0, true, false}, {[]interface{}{types.NewDecFromStringForTest("0.000001"), nil}, 0, true, false},