Skip to content

Commit

Permalink
executor: reset groupCount when Close is called in streamagg execut…
Browse files Browse the repository at this point in the history
…or (#53874)

close #53867
  • Loading branch information
xzhangxian1008 authored Jun 18, 2024
1 parent e47330c commit a5a1b67
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/executor/internal/vecgroupchecker/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ go_test(
],
embed = [":vecgroupchecker"],
flaky = True,
shard_count = 3,
shard_count = 4,
deps = [
"//pkg/config",
"//pkg/expression",
Expand Down
1 change: 1 addition & 0 deletions pkg/executor/internal/vecgroupchecker/vec_group_checker.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ func (e *VecGroupChecker) IsExhausted() bool {
func (e *VecGroupChecker) Reset() {
if e.groupOffset != nil {
e.groupOffset = e.groupOffset[:0]
e.groupCount = 0
}
if e.sameGroup != nil {
e.sameGroup = e.sameGroup[:0]
Expand Down
10 changes: 10 additions & 0 deletions pkg/executor/internal/vecgroupchecker/vec_group_checker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,13 @@ func TestVecGroupChecker(t *testing.T) {
require.Equal(t, e, 3)
require.True(t, groupChecker.IsExhausted())
}

func TestIssue53867(t *testing.T) {
checker := NewVecGroupChecker(nil, true, nil)
checker.groupOffset = make([]int, 20)
checker.nextGroupID = 10
checker.groupCount = 15
require.False(t, checker.IsExhausted())
checker.Reset()
require.True(t, checker.IsExhausted())
}

0 comments on commit a5a1b67

Please sign in to comment.