Skip to content

Commit

Permalink
cherry pick pingcap#30154 to release-5.1
Browse files Browse the repository at this point in the history
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
mengxin9014 authored and ti-srebot committed Nov 25, 2021
1 parent 6be3ac5 commit e22b7b8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions expression/expr_to_pb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -842,10 +842,13 @@ func (s *testEvaluatorSuite) TestExprPushDownToFlash(c *C) {
c.Assert(err, IsNil)
c.Assert(function.(*ScalarFunction).Function.PbCode(), Equals, tipb.ScalarFuncSig_SubDateDatetimeInt)
exprs = append(exprs, function)
<<<<<<< HEAD
function, err = NewFunction(mock.NewContext(), ast.DateSub, types.NewFieldType(mysql.TypeDatetime), stringColumn, intColumn, stringColumn)
c.Assert(err, IsNil)
c.Assert(function.(*ScalarFunction).Function.PbCode(), Equals, tipb.ScalarFuncSig_SubDateStringInt)
exprs = append(exprs, function)
=======
>>>>>>> e15b76875... expression : prevent function DATE_ADD/SUB_STRING_XXX pushed down to TiFlash (#30154)
function, err = NewFunction(mock.NewContext(), ast.SubDate, types.NewFieldType(mysql.TypeDatetime), datetimeColumn, intColumn, stringColumn)
c.Assert(err, IsNil)
c.Assert(function.(*ScalarFunction).Function.PbCode(), Equals, tipb.ScalarFuncSig_SubDateDatetimeInt)
Expand Down
6 changes: 5 additions & 1 deletion expression/expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -1038,12 +1038,16 @@ func scalarExprSupportedByFlash(function *ScalarFunction) bool {
}
case ast.DateAdd, ast.AddDate:
switch function.Function.PbCode() {
<<<<<<< HEAD
case tipb.ScalarFuncSig_AddDateDatetimeInt, tipb.ScalarFuncSig_AddDateStringInt:
=======
case tipb.ScalarFuncSig_AddDateDatetimeInt:
>>>>>>> e15b76875... expression : prevent function DATE_ADD/SUB_STRING_XXX pushed down to TiFlash (#30154)
return true
}
case ast.DateSub, ast.SubDate:
switch function.Function.PbCode() {
case tipb.ScalarFuncSig_SubDateDatetimeInt, tipb.ScalarFuncSig_SubDateStringInt:
case tipb.ScalarFuncSig_SubDateDatetimeInt:
return true
}
case ast.UnixTimestamp:
Expand Down

0 comments on commit e22b7b8

Please sign in to comment.