Unverified Commit 9f1be5c1 authored by Song Gao's avatar Song Gao Committed by GitHub
Browse files

expr: forbid push round with frac down (#32666)

close pingcap/tidb#32557
parent d385330b
Showing with 3 additions and 6 deletions
+3 -6
......@@ -1008,8 +1008,9 @@ func scalarExprSupportedByTiKV(sf *ScalarFunction) bool {
return true
case ast.Round:
switch sf.Function.PbCode() {
case tipb.ScalarFuncSig_RoundReal, tipb.ScalarFuncSig_RoundInt, tipb.ScalarFuncSig_RoundDec,
tipb.ScalarFuncSig_RoundWithFracReal, tipb.ScalarFuncSig_RoundWithFracInt, tipb.ScalarFuncSig_RoundWithFracDec:
case tipb.ScalarFuncSig_RoundReal, tipb.ScalarFuncSig_RoundInt, tipb.ScalarFuncSig_RoundDec:
// We don't push round with frac due to mysql's round with frac has its special behavior:
// https://dev.mysql.com/doc/refman/5.7/en/mathematical-functions.html#function_round
return true
}
case ast.Rand:
......
......@@ -2829,10 +2829,6 @@ func TestScalarFunctionPushDown(t *testing.T) {
tk.MustQuery("explain analyze select /*+read_from_storage(tikv[t])*/ * from t where round(b)").
CheckAt([]int{0, 3, 6}, rows)
rows[1][2] = "round(test.t.b, 2)"
tk.MustQuery("explain analyze select /*+read_from_storage(tikv[t])*/ * from t where round(b,2)").
CheckAt([]int{0, 3, 6}, rows)
rows[1][2] = "date(test.t.d)"
tk.MustQuery("explain analyze select /*+read_from_storage(tikv[t])*/ * from t where date(d)").
CheckAt([]int{0, 3, 6}, rows)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment