diff --git a/expression/builtin_json.go b/expression/builtin_json.go index e828cd11764af..e9f803dcc86df 100644 --- a/expression/builtin_json.go +++ b/expression/builtin_json.go @@ -772,28 +772,18 @@ func (c *jsonMemberOfFunctionClass) getFunction(ctx sessionctx.Context, args []E if err := c.verifyArgs(args); err != nil { return nil, err } - - argTps := []types.EvalType{args[0].GetType().EvalType(), types.ETJson} + argTps := []types.EvalType{types.ETJson, types.ETJson} bf, err := newBaseBuiltinFuncWithTp(ctx, c.funcName, args, types.ETInt, argTps...) if err != nil { return nil, err } + DisableParseJSONFlag4Expr(args[0]) sig := &builtinJSONMemberOfSig{bf} return sig, nil } func (b *builtinJSONMemberOfSig) evalInt(row chunk.Row) (res int64, isNull bool, err error) { - var target types.BinaryJSON - if b.args[0].GetType().EvalType() != types.ETJson { - eval, err := b.args[0].Eval(row) - if err != nil || eval.IsNull() { - return 0, eval.IsNull(), err - } - target = types.CreateBinaryJSON(eval.GetValue()) - } else { - target, isNull, err = b.args[0].EvalJSON(b.ctx, row) - } - + target, isNull, err := b.args[0].EvalJSON(b.ctx, row) if isNull || err != nil { return res, isNull, err } diff --git a/types/json_binary_functions.go b/types/json_binary_functions.go index 88de1f6a1ef1e..7c4d7bf7f97bc 100644 --- a/types/json_binary_functions.go +++ b/types/json_binary_functions.go @@ -1127,9 +1127,9 @@ func OverlapsBinaryJSON(obj, target BinaryJSON) bool { case JSONTypeCodeArray: if target.TypeCode == JSONTypeCodeArray { for i := 0; i < obj.GetElemCount(); i++ { - o := obj.arrayGetElem(i) + o := obj.ArrayGetElem(i) for j := 0; j < target.GetElemCount(); j++ { - if CompareBinaryJSON(o, target.arrayGetElem(j)) == 0 { + if CompareBinaryJSON(o, target.ArrayGetElem(j)) == 0 { return true } } @@ -1138,7 +1138,7 @@ func OverlapsBinaryJSON(obj, target BinaryJSON) bool { } elemCount := obj.GetElemCount() for i := 0; i < elemCount; i++ { - if CompareBinaryJSON(obj.arrayGetElem(i), target) == 0 { + if CompareBinaryJSON(obj.ArrayGetElem(i), target) == 0 { return true } }