Skip to content
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

planner: fix incorrect TableDual plan built from nulleq #24596

Merged
merged 24 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
9435573
add tcp4only for lvs
sylzd Dec 8, 2020
a19f66e
fix typo
sylzd Dec 8, 2020
66a261c
Merge branch 'master' into master
sylzd Dec 8, 2020
f620f14
Merge branch 'master' into master
sylzd Dec 8, 2020
ea27051
fix annotaion
sylzd Dec 8, 2020
7b4631b
fix
sylzd Dec 8, 2020
4187316
Merge branch 'master' into master
sylzd Dec 8, 2020
74b08ea
Merge branch 'master' into master
ti-srebot Dec 9, 2020
a4d0e75
Merge branch 'master' into master
XuHuaiyu Dec 9, 2020
aa3b66e
Merge branch 'master' into master
XuHuaiyu Dec 9, 2020
570c8f1
Merge branch 'master' into master
ti-srebot Dec 9, 2020
ebef90f
Merge branch 'master' into master
sylzd Dec 9, 2020
8c95fa1
Merge branch 'master' of https://github.com/pingcap/tidb into pingcap
sylzd Jan 21, 2021
ba5e45e
Merge branch 'master' of https://github.com/pingcap/tidb into pingcap
sylzd Jan 26, 2021
f011c3a
Merge branch 'master' of https://github.com/pingcap/tidb into pingcap
sylzd May 7, 2021
007d19b
Merge branch 'master' of https://github.com/pingcap/tidb into pingcap
sylzd May 10, 2021
7bf491e
fix issue24477: nulleq with null value in year type goes wrong result
sylzd May 12, 2021
84dcdfe
Merge branch 'master' into fix_24477
sylzd May 13, 2021
1df3b96
fix
sylzd May 13, 2021
54806f6
Merge branch 'fix_24477' of github.com:sylzd/tidb into fix_24477
sylzd May 13, 2021
e2a5787
add UT of 24477
sylzd May 13, 2021
40d5128
Merge branch 'master' into fix_24477
ti-chi-bot May 13, 2021
bb2891a
Merge branch 'master' into fix_24477
ti-chi-bot May 13, 2021
4dbff3c
Merge branch 'master' into fix_24477
ti-chi-bot May 13, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion util/ranger/points.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,8 @@ func (r *builder) buildFormBinOp(expr *expression.ScalarFunction) []*point {
if col.RetType.EvalType() == types.ETString && (value.Kind() == types.KindString || value.Kind() == types.KindBinaryLiteral) {
value.SetString(value.GetString(), col.RetType.Collate)
}
if col.GetType().Tp == mysql.TypeYear {
// If nulleq with null value, values.ToInt64 will return err
if col.GetType().Tp == mysql.TypeYear && !value.IsNull() {
// If the original value is adjusted, we need to change the condition.
// For example, col < 2156. Since the max year is 2155, 2156 is changed to 2155.
// col < 2155 is wrong. It should be col <= 2155.
Expand Down
3 changes: 2 additions & 1 deletion util/ranger/ranger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1504,12 +1504,13 @@ func (s *testRangerSuite) TestIndexRangeForYear(c *C) {
// test index range
testKit.MustExec("DROP TABLE IF EXISTS t")
testKit.MustExec("CREATE TABLE t (a year(4), key(a))")
testKit.MustExec("INSERT INTO t VALUES (1), (70), (99), (0), ('0')")
testKit.MustExec("INSERT INTO t VALUES (1), (70), (99), (0), ('0'), (NULL)")
testKit.MustQuery("SELECT * FROM t WHERE a < 15698").Check(testkit.Rows("0", "1970", "1999", "2000", "2001"))
testKit.MustQuery("SELECT * FROM t WHERE a <= 0").Check(testkit.Rows("0"))
testKit.MustQuery("SELECT * FROM t WHERE a <= 1").Check(testkit.Rows("0", "1970", "1999", "2000", "2001"))
testKit.MustQuery("SELECT * FROM t WHERE a < 2000").Check(testkit.Rows("0", "1970", "1999"))
testKit.MustQuery("SELECT * FROM t WHERE a > -1").Check(testkit.Rows("0", "1970", "1999", "2000", "2001"))
testKit.MustQuery("SELECT * FROM t WHERE a <=> NULL").Check(testkit.Rows("<nil>"))

tests := []struct {
indexPos int
Expand Down