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

executor: reset groupChecker for StreamAggExec when Close (#10615) #10670

Merged
merged 2 commits into from
May 31, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
6 changes: 6 additions & 0 deletions executor/aggregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,12 @@ func (e *StreamAggExec) Open(ctx context.Context) error {
// Close implements the Executor Close interface.
func (e *StreamAggExec) Close() error {
e.childResult = nil
if e.curGroupKey != nil {
e.curGroupKey = e.curGroupKey[:0]
}
if e.tmpGroupKey != nil {
e.tmpGroupKey = e.tmpGroupKey[:0]
}
return errors.Trace(e.baseExecutor.Close())
}

Expand Down
10 changes: 10 additions & 0 deletions executor/aggregate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,3 +708,13 @@ func (s *testSuite) TestIssue10098(c *C) {
tk.MustExec("insert into t values('1', '222'), ('12', '22')")
tk.MustQuery("select group_concat(distinct a, b) from t").Check(testkit.Rows("1222,1222"))
}

func (s *testSuite) TestIssue10608(c *C) {
tk := testkit.NewTestKitWithInit(c, s.store)
tk.MustExec(`drop table if exists t, s;`)
tk.MustExec("CREATE TABLE t (id int(11) NOT NULL,PRIMARY KEY (id)) ;")
tk.MustExec("CREATE TABLE s (id int(11) NOT NULL,b int(11) NOT NULL,PRIMARY KEY (id)) ")
tk.MustExec("INSERT INTO t VALUES (508931),(508932); ")
tk.MustExec("INSERT INTO s VALUES (100292, 508931),(120002, 508932);")
tk.MustQuery("select (select group_concat(concat(123,'-')) from t where t.id = b group by t.id) from s;").Check(testkit.Rows("123-", "123-"))
}