-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
expression: open CAST push down switcher default #12652
Conversation
Signed-off-by: Lonng <[email protected]>
Signed-off-by: H-ZeX <[email protected]>
Signed-off-by: H-ZeX <[email protected]>
Signed-off-by: H-ZeX <[email protected]>
Signed-off-by: H-ZeX <[email protected]>
Codecov Report
@@ Coverage Diff @@
## master #12652 +/- ##
=========================================
Coverage 80.181% 80.181%
=========================================
Files 469 469
Lines 111555 111555
=========================================
Hits 89446 89446
Misses 15200 15200
Partials 6909 6909 |
Signed-off-by: Lonng <[email protected]>
Signed-off-by: Lonng <[email protected]>
/run-all-tests tidb-test=pr/918 |
Signed-off-by: Lonng <[email protected]>
Signed-off-by: Lonng <[email protected]>
LGTM |
Coprocessor integration test: tikv/copr-test#4 |
data = types.Datum{} | ||
data.SetMysqlDecimal(to) | ||
if err != nil { | ||
return data, err |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why put return
after creating data
? If err != nil
, to
is not even integral.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should return the data even though overflow occurred (the caller should handle it in a proper way if the err is overflow or truncated).
@@ -54,7 +55,7 @@ func (d *distinctChecker) Check(values []types.Datum) (bool, error) { | |||
} | |||
|
|||
// calculateSum adds v to sum. | |||
func calculateSum(sc *stmtctx.StatementContext, sum, v types.Datum) (data types.Datum, err error) { | |||
func calculateSum(sc *stmtctx.StatementContext, sum, v types.Datum, retType *types.FieldType) (data types.Datum, err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the relationship between pushdown CAST and calculateSum
? Are there any test cases for sum
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are many test cases that will cover the sum
(query with sum/avg
aggregation functions). The is no direct relationship with CAST
and sum
and I modify it because of the previous implementation does not round appropriately (this BUG is detected by this PR).
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/run-all-tests tidb-test=pr/940 |
/run-integration-common-test tidb-test=pr/940 |
js, err := json.Marshal(pbExpr) | ||
c.Assert(err, IsNil) | ||
c.Assert(string(js), Equals, "null") | ||
c.Assert(string(js), Equals, expects[i]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does this result change?
/run-integration-common-test tidb-test=pr/940 |
/run-all-tests tidb-test=pr/940 |
This reverts commit a785493.
Benchmark Report
@@ Benchmark Diff @@
================================================================================
--- tidb: 79756747e706c2c706ecb00e8f1459796295656c
+++ tidb: a04215ca624cf90b2228882fbb49b4abbcbfd5cd
tikv: 1999eaf8a6da5d4d7cc8f89a0d1127c516614aef
pd: d6d08d9b58fa42a29c3b3f517b9a64a562475588
================================================================================
oltp_update_non_index:
* QPS: 4712.26 ± 0.35% (std=10.55) delta: 0.01% (p=0.949)
* Latency p50: 27.16 ± 0.36% (std=0.06) delta: 0.00%
* Latency p99: 42.43 ± 4.09% (std=1.14) delta: 2.00%
oltp_insert:
* QPS: 3883.00 ± 0.82% (std=20.38) delta: -0.79% (p=0.151)
* Latency p50: 32.96 ± 0.81% (std=0.17) delta: 0.80%
* Latency p99: 75.82 ± 0.00% (std=0.00) delta: 0.90%
oltp_read_write:
* QPS: 15614.20 ± 0.14% (std=19.90) delta: 0.29% (p=0.118)
* Latency p50: 164.30 ± 0.14% (std=0.21) delta: -0.26%
* Latency p99: 323.08 ± 0.90% (std=2.91) delta: -0.30%
oltp_update_index:
* QPS: 4257.40 ± 0.02% (std=0.62) delta: 0.09% (p=0.300)
* Latency p50: 30.06 ± 0.07% (std=0.01) delta: -0.10%
* Latency p99: 54.83 ± 0.00% (std=0.00) delta: 3.66%
oltp_point_select:
* QPS: 50142.42 ± 0.46% (std=183.88) delta: 0.23% (p=0.631)
* Latency p50: 2.55 ± 0.39% (std=0.01) delta: -0.29%
* Latency p99: 8.90 ± 0.00% (std=0.00) delta: 0.45%
|
Signed-off-by: Lonng <[email protected]>
…)" (pingcap#13264) This reverts commit a785493.
Signed-off-by: Lonng [email protected]
What problem does this PR solve?
Open the CAST push-down switcher and fix some execution plans.
What is changed and how it works?
We have fixed all CAST functions related inconsistent between TiDB and TiKV, it's time to open the switcher default.
Check List
Tests
Release note