Skip to content

Commit

Permalink
executor: clean outerMatchedStatus when HashJoin.C ... (#19510) (#19611)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Sep 1, 2020
1 parent c78d6c8 commit 00c6a4a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions executor/join.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ func (e *HashJoinExec) Close() error {
e.joinChkResourceCh = nil
terror.Call(e.rowContainer.Close)
}
e.outerMatchedStatus = e.outerMatchedStatus[:0]

if e.runtimeStats != nil {
concurrency := cap(e.joiners)
Expand Down
15 changes: 15 additions & 0 deletions executor/join_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2254,3 +2254,18 @@ func (s *testSuiteJoin3) TestIssue19498(c *C) {
rs = tk.MustQuery("select c_str, (select /*+ INL_MERGE_JOIN(t1,t3) */ max(t1.c_int) from t1, t3 where t1.c_int = t3.c_int and t2.c_str > t3.c_str) q from t2 order by c_str;")
rs.Check(testkit.Rows("happy archimedes 2", "happy fermat 2", "happy hypatia 2", "zen sammet 4"))
}

func (s *testSuiteJoin3) TestIssue19500(c *C) {
tk := testkit.NewTestKitWithInit(c, s.store)
tk.MustExec("drop table if exists t1;")
tk.MustExec("create table t1 (c_int int, primary key (c_int));")
tk.MustExec("insert into t1 values (1),(2),(3),(4),(5);")
tk.MustExec("drop table if exists t2;")
tk.MustExec("create table t2 (c_int int unsigned, c_str varchar(40), primary key (c_int), key (c_str));")
tk.MustExec("insert into t2 values (1, 'dazzling panini'),(2, 'infallible perlman'),(3, 'recursing cannon'),(4, 'vigorous satoshi'),(5, 'vigilant gauss'),(6, 'nervous jackson');\n")
tk.MustExec("drop table if exists t3;")
tk.MustExec("create table t3 (c_int int, c_str varchar(40), key (c_str));")
tk.MustExec("insert into t3 values (1, 'sweet morse'),(2, 'reverent golick'),(3, 'clever rubin'),(4, 'flamboyant morse');")
tk.MustQuery("select (select (select sum(c_int) from t3 where t3.c_str > t2.c_str) from t2 where t2.c_int > t1.c_int order by c_int limit 1) q from t1 order by q;").
Check(testkit.Rows("<nil>", "<nil>", "3", "3", "3"))
}

0 comments on commit 00c6a4a

Please sign in to comment.