Skip to content

Commit

Permalink
fix panic
Browse files Browse the repository at this point in the history
  • Loading branch information
xzhangxian1008 committed Feb 23, 2024
1 parent 089f7fa commit 6d752af
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/executor/sortexec/topn.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ func (e *TopNExec) Open(ctx context.Context) error {
e.memTracker.AttachTo(e.Ctx().GetSessionVars().StmtCtx.MemTracker)

e.fetched = false

e.chkHeap = &topNChunkHeap{TopNExec: e}
e.chkHeap.Idx = 0

return exec.Open(ctx, e.Children(0))
Expand Down Expand Up @@ -234,7 +236,7 @@ func (e *TopNExec) doCompaction(chkHeap *topNChunkHeap) error {
e.memTracker.ReplaceChild(chkHeap.rowChunks.GetMemTracker(), newRowChunks.GetMemTracker())
chkHeap.rowChunks = newRowChunks

e.memTracker.Consume(int64(8 * len(newRowPtrs) - 8 * len(chkHeap.rowPtrs)))
e.memTracker.Consume(int64(8*len(newRowPtrs) - 8*len(chkHeap.rowPtrs)))
chkHeap.rowPtrs = newRowPtrs
return nil
}

0 comments on commit 6d752af

Please sign in to comment.