diff --git a/expression/expression.go b/expression/expression.go index cbfa4bfb0ee24..af3107770ff2f 100644 --- a/expression/expression.go +++ b/expression/expression.go @@ -1071,8 +1071,7 @@ func scalarExprSupportedByTiKV(sf *ScalarFunction) bool { // json functions. ast.JSONType, ast.JSONExtract, ast.JSONObject, ast.JSONArray, ast.JSONMerge, ast.JSONSet, ast.JSONInsert /*ast.JSONReplace,*/, ast.JSONRemove, ast.JSONLength, - // FIXME: JSONUnquote is incompatible with Coprocessor - ast.JSONUnquote, ast.JSONContains, + ast.JSONUnquote, ast.JSONContains, ast.JSONValid, // date functions. ast.Date, ast.Week /* ast.YearWeek, ast.ToSeconds */, ast.DateDiff, diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index a2aa3d643f609..d0cbd57f80a9e 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -3375,6 +3375,10 @@ func TestScalarFunctionPushDown(t *testing.T) { tk.MustQuery("explain analyze select /*+read_from_storage(tikv[t])*/ * from t where ascii(e);"). CheckAt([]int{0, 3, 6}, rows) + rows[1][2] = "eq(json_valid(test.t.c), 1)" + tk.MustQuery("explain analyze select /*+read_from_storage(tikv[t])*/ * from t where json_valid(c)=1;"). + CheckAt([]int{0, 3, 6}, rows) + rows[1][2] = "json_contains(cast(test.t.c, json BINARY), cast(\"1\", json BINARY))" tk.MustQuery("explain analyze select /*+read_from_storage(tikv[t])*/ * from t where json_contains(c, '1');"). CheckAt([]int{0, 3, 6}, rows)