expression: push down json_valid to tikv (#38290)

close pingcap/tidb#38289
This commit is contained in:
lizhenhuan
2022-11-17 12:07:55 +08:00
committed by GitHub
parent e78ef2c9e3
commit b296494802
2 changed files with 5 additions and 2 deletions

View File

@ -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,

View File

@ -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)