Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
jiawen li
tidb
Commits
9f1be5c1
Unverified
Commit
9f1be5c1
authored
3 years ago
by
Song Gao
Committed by
GitHub
3 years ago
Browse files
Options
Download
Email Patches
Plain Diff
expr: forbid push round with frac down (#32666)
close pingcap/tidb#32557
parent
d385330b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
expression/expression.go
+3
-2
expression/expression.go
planner/core/integration_test.go
+0
-4
planner/core/integration_test.go
with
3 additions
and
6 deletions
+3
-6
expression/expression.go
+
3
-
2
View file @
9f1be5c1
...
...
@@ -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
:
...
...
This diff is collapsed.
Click to expand it.
planner/core/integration_test.go
+
0
-
4
View file @
9f1be5c1
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment