Skip to content

Commit

Permalink
Merge branch 'release-5.1' into cp_27267
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Sep 16, 2021
2 parents 699a3fe + 3c49716 commit 9562d56
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 21 deletions.
3 changes: 1 addition & 2 deletions expression/expr_to_pb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ func (s *testEvaluatorSuite) TestArithmeticalFunc2Pb(c *C) {
jsons[ast.Minus] = "{\"tp\":10000,\"children\":[{\"tp\":201,\"val\":\"gAAAAAAAAAE=\",\"sig\":0,\"field_type\":{\"tp\":5,\"flag\":0,\"flen\":-1,\"decimal\":-1,\"collate\":63,\"charset\":\"\"},\"has_distinct\":false},{\"tp\":201,\"val\":\"gAAAAAAAAAI=\",\"sig\":0,\"field_type\":{\"tp\":5,\"flag\":0,\"flen\":-1,\"decimal\":-1,\"collate\":63,\"charset\":\"\"},\"has_distinct\":false}],\"sig\":204,\"field_type\":{\"tp\":5,\"flag\":128,\"flen\":-1,\"decimal\":-1,\"collate\":63,\"charset\":\"binary\"},\"has_distinct\":false}"
jsons[ast.Mul] = "{\"tp\":10000,\"children\":[{\"tp\":201,\"val\":\"gAAAAAAAAAE=\",\"sig\":0,\"field_type\":{\"tp\":5,\"flag\":0,\"flen\":-1,\"decimal\":-1,\"collate\":63,\"charset\":\"\"},\"has_distinct\":false},{\"tp\":201,\"val\":\"gAAAAAAAAAI=\",\"sig\":0,\"field_type\":{\"tp\":5,\"flag\":0,\"flen\":-1,\"decimal\":-1,\"collate\":63,\"charset\":\"\"},\"has_distinct\":false}],\"sig\":208,\"field_type\":{\"tp\":5,\"flag\":128,\"flen\":-1,\"decimal\":-1,\"collate\":63,\"charset\":\"binary\"},\"has_distinct\":false}"
jsons[ast.Div] = "{\"tp\":10000,\"children\":[{\"tp\":201,\"val\":\"gAAAAAAAAAE=\",\"sig\":0,\"field_type\":{\"tp\":5,\"flag\":0,\"flen\":-1,\"decimal\":-1,\"collate\":63,\"charset\":\"\"},\"has_distinct\":false},{\"tp\":201,\"val\":\"gAAAAAAAAAI=\",\"sig\":0,\"field_type\":{\"tp\":5,\"flag\":0,\"flen\":-1,\"decimal\":-1,\"collate\":63,\"charset\":\"\"},\"has_distinct\":false}],\"sig\":211,\"field_type\":{\"tp\":5,\"flag\":128,\"flen\":23,\"decimal\":-1,\"collate\":63,\"charset\":\"binary\"},\"has_distinct\":false}"
jsons[ast.Mod] = "{\"tp\":10000,\"children\":[{\"tp\":201,\"val\":\"gAAAAAAAAAE=\",\"sig\":0,\"field_type\":{\"tp\":5,\"flag\":0,\"flen\":-1,\"decimal\":-1,\"collate\":63,\"charset\":\"\"},\"has_distinct\":false},{\"tp\":201,\"val\":\"gAAAAAAAAAI=\",\"sig\":0,\"field_type\":{\"tp\":5,\"flag\":0,\"flen\":-1,\"decimal\":-1,\"collate\":63,\"charset\":\"\"},\"has_distinct\":false}],\"sig\":215,\"field_type\":{\"tp\":5,\"flag\":128,\"flen\":23,\"decimal\":-1,\"collate\":63,\"charset\":\"binary\"},\"has_distinct\":false}"

pbExprs, err := ExpressionsToPBList(sc, arithmeticalFuncs, client)
c.Assert(err, IsNil)
Expand All @@ -328,7 +327,7 @@ func (s *testEvaluatorSuite) TestArithmeticalFunc2Pb(c *C) {
c.Assert(string(js), Equals, jsons[funcNames[i]], Commentf("%v\n", funcNames[i]))
}

funcNames = []string{ast.IntDiv} // cannot be pushed down
funcNames = []string{ast.Mod, ast.IntDiv} // cannot be pushed down
for _, funcName := range funcNames {
fc, err := NewFunction(
mock.NewContext(),
Expand Down
2 changes: 1 addition & 1 deletion expression/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -1006,7 +1006,7 @@ func scalarExprSupportedByFlash(function *ScalarFunction) bool {
case
ast.LogicOr, ast.LogicAnd, ast.UnaryNot, ast.BitNeg, ast.Xor, ast.And, ast.Or,
ast.GE, ast.LE, ast.EQ, ast.NE, ast.LT, ast.GT, ast.In, ast.IsNull, ast.Like,
ast.Plus, ast.Minus, ast.Div, ast.Mul, ast.Abs, ast.Mod,
ast.Plus, ast.Minus, ast.Div, ast.Mul, ast.Abs, /*ast.Mod,*/
ast.If, ast.Ifnull, ast.Case,
ast.Concat, ast.ConcatWS,
ast.Year, ast.Month, ast.Day,
Expand Down
25 changes: 11 additions & 14 deletions planner/core/testdata/integration_serial_suite_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -2581,20 +2581,17 @@
"SQL": "desc format = 'brief' select * from t join t t1 on t.id = t1.id order by t.value % 100 limit 1",
"Plan": [
"Projection 1.00 root test.t.id, test.t.value, test.t.id, test.t.value",
"└─TopN 1.00 root Column#8, offset:0, count:1",
" └─Projection 1.00 root test.t.id, test.t.value, test.t.id, test.t.value, mod(test.t.value, 100)->Column#8",
" └─TableReader 1.00 root data:ExchangeSender",
" └─ExchangeSender 1.00 batchCop[tiflash] ExchangeType: PassThrough",
" └─Projection 1.00 batchCop[tiflash] test.t.id, test.t.value, test.t.id, test.t.value",
" └─TopN 1.00 batchCop[tiflash] Column#7, offset:0, count:1",
" └─Projection 12487.50 batchCop[tiflash] test.t.id, test.t.value, test.t.id, test.t.value, mod(test.t.value, 100)->Column#7",
" └─HashJoin 12487.50 batchCop[tiflash] inner join, equal:[eq(test.t.id, test.t.id)]",
" ├─ExchangeReceiver(Build) 9990.00 batchCop[tiflash] ",
" │ └─ExchangeSender 9990.00 batchCop[tiflash] ExchangeType: Broadcast",
" │ └─Selection 9990.00 batchCop[tiflash] not(isnull(test.t.id))",
" │ └─TableFullScan 10000.00 batchCop[tiflash] table:t keep order:false, stats:pseudo",
" └─Selection(Probe) 9990.00 batchCop[tiflash] not(isnull(test.t.id))",
" └─TableFullScan 10000.00 batchCop[tiflash] table:t1 keep order:false, stats:pseudo"
"└─TopN 1.00 root Column#7, offset:0, count:1",
" └─Projection 12487.50 root test.t.id, test.t.value, test.t.id, test.t.value, mod(test.t.value, 100)->Column#7",
" └─TableReader 12487.50 root data:ExchangeSender",
" └─ExchangeSender 12487.50 cop[tiflash] ExchangeType: PassThrough",
" └─HashJoin 12487.50 cop[tiflash] inner join, equal:[eq(test.t.id, test.t.id)]",
" ├─ExchangeReceiver(Build) 9990.00 cop[tiflash] ",
" │ └─ExchangeSender 9990.00 cop[tiflash] ExchangeType: Broadcast",
" │ └─Selection 9990.00 cop[tiflash] not(isnull(test.t.id))",
" │ └─TableFullScan 10000.00 cop[tiflash] table:t keep order:false, stats:pseudo",
" └─Selection(Probe) 9990.00 cop[tiflash] not(isnull(test.t.id))",
" └─TableFullScan 10000.00 cop[tiflash] table:t1 keep order:false, stats:pseudo"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion planner/core/testdata/plan_suite_in.json
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@
"cases": [
"select /*+ LIMIT_TO_COP() */ * from tn where a = 1 and b > 10 and b < 20 and c > 50 order by d limit 1",
"select * from tn where a = 1 and b > 10 and b < 20 and c > 50 order by d limit 1",
"select /*+ LIMIT_TO_COP() */ a from tn where a div 2 order by a limit 1",
"select /*+ LIMIT_TO_COP() */ a from tn where mod(a, 2) order by a limit 1",
"select /*+ LIMIT_TO_COP() */ a from tn where a > 10 limit 1"
]
},
Expand Down
6 changes: 3 additions & 3 deletions planner/core/testdata/plan_suite_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -1500,15 +1500,15 @@
"Warning": null
},
{
"SQL": "select /*+ LIMIT_TO_COP() */ a from tn where a div 2 order by a limit 1",
"SQL": "select /*+ LIMIT_TO_COP() */ a from tn where mod(a, 2) order by a limit 1",
"Plan": [
"Limit 1.00 root offset:0, count:1",
"└─Selection 1.00 root intdiv(test.tn.a, 2)",
"└─Selection 1.00 root mod(test.tn.a, 2)",
" └─IndexReader 1.00 root index:IndexFullScan",
" └─IndexFullScan 1.00 cop[tikv] table:tn, index:a(a, b, c, d) keep order:true, stats:pseudo"
],
"Warning": [
"Scalar function 'intdiv'(signature: IntDivideInt) can not be pushed to storage layer",
"Scalar function 'mod'(signature: ModIntSignedSigned) can not be pushed to storage layer",
"[planner:1815]Optimizer Hint LIMIT_TO_COP is inapplicable"
]
},
Expand Down

0 comments on commit 9562d56

Please sign in to comment.