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

statistics: fix a bug which causes panic when using the clustered index and the new collation (#21379) #21408

Merged
merged 51 commits into from
May 11, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
09122fa
cherry pick #21379 to release-4.0
wjhuang2016 Dec 1, 2020
ba079c8
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
qw4990 Jan 28, 2021
dc31cf6
fix CI
qw4990 Jan 28, 2021
9d9b992
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
xiongjiwei Jan 29, 2021
e85a66f
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
wjhuang2016 Apr 16, 2021
f3ceda0
Update integration_test.go
wjhuang2016 Apr 16, 2021
c310644
Update integration_test.go
wjhuang2016 Apr 16, 2021
40caef3
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot Apr 16, 2021
9bc61ba
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot Apr 30, 2021
e2cf7ab
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot Apr 30, 2021
653e277
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot Apr 30, 2021
f001b2b
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot Apr 30, 2021
6144924
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 6, 2021
f5ee1ce
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 6, 2021
946bf4f
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 6, 2021
dbb92bc
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 6, 2021
ba54f72
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 6, 2021
b446e60
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 6, 2021
57a0110
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 6, 2021
c519edf
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 6, 2021
fa5880f
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 6, 2021
4f6142b
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 6, 2021
6cfa604
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 6, 2021
743758e
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 7, 2021
07caea7
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 7, 2021
db2d884
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 7, 2021
629e904
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 8, 2021
d448ed6
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 8, 2021
189bec8
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 8, 2021
fb9ae98
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 8, 2021
f7dde39
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
0c5a046
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
87473fb
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
61ca9a9
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
e250287
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
02a5517
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
74aaa03
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
a0129db
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
1262c3c
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
0d7c1ff
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
b87ca0a
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
5af9366
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
d755b28
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
89c702d
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
d212a0d
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
041b098
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
fdc7da7
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 10, 2021
d378edc
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 11, 2021
40ed879
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 11, 2021
9ceae63
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 11, 2021
f5d3d29
Merge branch 'release-4.0' into release-4.0-5131514ebb8b
ti-chi-bot May 11, 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
19 changes: 19 additions & 0 deletions expression/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7591,6 +7591,25 @@ func (s *testIntegrationSerialSuite) TestCollationIndexJoin(c *C) {
tk.MustQuery("show warnings").Check(testkit.Rows("Warning 1815 Optimizer Hint /*+ INL_MERGE_JOIN(t2) */ is inapplicable"))
}

func (s *testIntegrationSerialSuite) TestIssue20876(c *C) {
collate.SetNewCollationEnabledForTest(true)
defer collate.SetNewCollationEnabledForTest(false)
tk := testkit.NewTestKit(c, s.store)
tk.MustExec("set @@tidb_enable_clustered_index=1;")
tk.MustExec("use test")
tk.MustExec("drop table if exists t;")
tk.MustExec("CREATE TABLE `t` (" +
" `a` char(10) COLLATE utf8mb4_unicode_ci NOT NULL," +
" `b` char(20) COLLATE utf8mb4_general_ci NOT NULL," +
" `c` int(11) NOT NULL," +
" PRIMARY KEY (`a`,`b`,`c`)," +
" KEY `idx` (`a`)" +
")")
tk.MustExec("insert into t values ('#', 'C', 10), ('$', 'c', 20), ('$', 'c', 30), ('a', 'a', 10), ('A', 'A', 30)")
tk.MustExec("analyze table t")
tk.MustQuery("select * from t where a='#';").Check(testkit.Rows("# C 10"))
}

func (s *testIntegrationSuite2) TestCastCoer(c *C) {
tk := testkit.NewTestKit(c, s.store)

Expand Down
12 changes: 2 additions & 10 deletions statistics/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -785,18 +785,10 @@ func (c *Column) GetColumnRowCount(sc *stmtctx.StatementContext, ranges []*range
highVal := *rg.HighVal[0].Clone()
lowVal := *rg.LowVal[0].Clone()
if highVal.Kind() == types.KindString {
highVal.SetBytesAsString(collate.GetCollator(
highVal.Collation()).Key(highVal.GetString()),
highVal.Collation(),
uint32(highVal.Length()),
)
highVal.SetBytes(collate.GetCollator(highVal.Collation()).Key(highVal.GetString()))
}
if lowVal.Kind() == types.KindString {
lowVal.SetBytesAsString(collate.GetCollator(
lowVal.Collation()).Key(lowVal.GetString()),
lowVal.Collation(),
uint32(lowVal.Length()),
)
lowVal.SetBytes(collate.GetCollator(lowVal.Collation()).Key(lowVal.GetString()))
}
cmp, err := lowVal.CompareDatum(sc, &highVal)
if err != nil {
Expand Down