Skip to content

Commit

Permalink
expr: switch off left push down due to intergration test failed (#33302
Browse files Browse the repository at this point in the history
…) (#33304)

close #33255, ref #33256
  • Loading branch information
ti-srebot committed Mar 24, 2022
1 parent f993354 commit 9277dc9
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 21 deletions.
5 changes: 0 additions & 5 deletions expression/expr_to_pb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion expression/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 0 additions & 4 deletions planner/core/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
21 changes: 10 additions & 11 deletions planner/core/testdata/integration_suite_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down

0 comments on commit 9277dc9

Please sign in to comment.