diff --git a/expression/expr_to_pb_test.go b/expression/expr_to_pb_test.go index 610beede45..cf949394e7 100644 --- a/expression/expr_to_pb_test.go +++ b/expression/expr_to_pb_test.go @@ -1246,11 +1246,6 @@ func TestExprPushDownToTiKV(t *testing.T) { retType: types.NewFieldType(mysql.TypeString), args: []Expression{stringColumn, intColumn}, }, - { - functionName: ast.Left, - retType: types.NewFieldType(mysql.TypeString), - args: []Expression{stringColumn, intColumn}, - }, { functionName: ast.Sin, retType: types.NewFieldType(mysql.TypeDouble), diff --git a/expression/expression.go b/expression/expression.go index d611f1a8c8..fe56ff5520 100644 --- a/expression/expression.go +++ b/expression/expression.go @@ -975,7 +975,7 @@ func scalarExprSupportedByTiKV(sf *ScalarFunction) bool { ast.Length, ast.BitLength, ast.Concat, ast.ConcatWS, ast.Replace, ast.ASCII, ast.Hex, ast.Reverse, ast.LTrim, ast.RTrim, ast.Strcmp, ast.Space, ast.Elt, ast.Field, InternalFuncFromBinary, InternalFuncToBinary, ast.Mid, ast.Substring, ast.Substr, ast.CharLength, - ast.Right, ast.Left, + ast.Right, /* ast.Left */ // json functions. ast.JSONType, ast.JSONExtract, ast.JSONObject, ast.JSONArray, ast.JSONMerge, ast.JSONSet, diff --git a/planner/core/integration_test.go b/planner/core/integration_test.go index 75f3c65186..e87e689d67 100644 --- a/planner/core/integration_test.go +++ b/planner/core/integration_test.go @@ -2771,10 +2771,6 @@ func TestScalarFunctionPushDown(t *testing.T) { tk.MustQuery("explain analyze select /*+read_from_storage(tikv[t])*/ * from t where right(c,1);"). CheckAt([]int{0, 3, 6}, rows) - rows[1][2] = "left(test.t.c, 1)" - tk.MustQuery("explain analyze select /*+read_from_storage(tikv[t])*/ * from t where left(c,1);"). - CheckAt([]int{0, 3, 6}, rows) - rows[1][2] = "mod(test.t.id, test.t.id)" tk.MustQuery("explain analyze select /*+read_from_storage(tikv[t])*/ * from t where mod(id, id);"). CheckAt([]int{0, 3, 6}, rows) diff --git a/planner/core/testdata/integration_suite_out.json b/planner/core/testdata/integration_suite_out.json index 242bac6254..0024560973 100644 --- a/planner/core/testdata/integration_suite_out.json +++ b/planner/core/testdata/integration_suite_out.json @@ -2077,11 +2077,11 @@ "SQL": "select /*+ use_index_merge(t1) */ 1 from t1 where c1 = 'ab' or c2 = '10' and char_length(left(c1, 10)) = 10;", "Plan": [ "Projection 17.99 root 1->Column#5", - "└─IndexMerge 0.04 root ", - " ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t1, index:c1(c1) range:[\"ab\",\"ab\"], keep order:false, stats:pseudo", - " ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t1, index:c2(c2) range:[\"10\",\"10\"], keep order:false, stats:pseudo", - " └─Selection(Probe) 0.04 cop[tikv] or(eq(test.t1.c1, \"ab\"), and(eq(test.t1.c2, \"10\"), eq(char_length(left(test.t1.c1, 10)), 10)))", - " └─TableRowIDScan 19.99 cop[tikv] table:t1 keep order:false, stats:pseudo" + "└─Selection 0.04 root or(eq(test.t1.c1, \"ab\"), and(eq(test.t1.c2, \"10\"), eq(char_length(left(test.t1.c1, 10)), 10)))", + " └─IndexMerge 19.99 root ", + " ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t1, index:c1(c1) range:[\"ab\",\"ab\"], keep order:false, stats:pseudo", + " ├─IndexRangeScan(Build) 10.00 cop[tikv] table:t1, index:c2(c2) range:[\"10\",\"10\"], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 19.99 cop[tikv] table:t1 keep order:false, stats:pseudo" ], "Res": [ "1" @@ -2105,12 +2105,11 @@ "SQL": "select /*+ use_index_merge( tt2 ) */ 1 from tt2 where tt2.c1 in (-3896405) or tt2.pk in (1, 53330) and to_base64(left(pk, 5));", "Plan": [ "Projection 2.60 root 1->Column#3", - "└─IndexMerge 0.00 root ", - " ├─IndexRangeScan(Build) 1.00 cop[tikv] table:tt2, index:c1(c1) range:[-3896405,-3896405], keep order:false, stats:pseudo", - " ├─Selection(Build) 1.60 cop[tikv] istrue_with_null(cast(to_base64(left(cast(test.tt2.pk, var_string(20)), 5)), double BINARY))", - " │ └─TableRangeScan 2.00 cop[tikv] table:tt2 range:[1,1], [53330,53330], keep order:false, stats:pseudo", - " └─Selection(Probe) 0.00 cop[tikv] or(eq(test.tt2.c1, -3896405), and(in(test.tt2.pk, 1, 53330), istrue_with_null(cast(to_base64(left(cast(test.tt2.pk, var_string(20)), 5)), double BINARY))))", - " └─TableRowIDScan 3.00 cop[tikv] table:tt2 keep order:false, stats:pseudo" + "└─Selection 0.00 root or(eq(test.tt2.c1, -3896405), and(in(test.tt2.pk, 1, 53330), istrue_with_null(cast(to_base64(left(cast(test.tt2.pk, var_string(20)), 5)), double BINARY))))", + " └─IndexMerge 3.00 root ", + " ├─IndexRangeScan(Build) 1.00 cop[tikv] table:tt2, index:c1(c1) range:[-3896405,-3896405], keep order:false, stats:pseudo", + " ├─TableRangeScan(Build) 2.00 cop[tikv] table:tt2 range:[1,1], [53330,53330], keep order:false, stats:pseudo", + " └─TableRowIDScan(Probe) 3.00 cop[tikv] table:tt2 keep order:false, stats:pseudo" ], "Res": [ "1"