Skip to content

Commit 4d98817

Browse files
guo-shaogeti-chi-bot
authored andcommitted
This is an automated cherry-pick of pingcap#48839
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
1 parent 069631e commit 4d98817

File tree

3 files changed

+580
-0
lines changed

3 files changed

+580
-0
lines changed

pkg/executor/cte.go

+10
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,16 @@ func (p *cteProducer) computeChunkHash(chk *chunk.Chunk) (sel []int, err error)
545545
hashBitMap[val] = true
546546
}
547547
} else {
548+
// Length of p.sel is init as MaxChunkSize, but the row num of chunk may still exceeds MaxChunkSize.
549+
// So needs to handle here to make sure len(p.sel) == chk.NumRows().
550+
if len(p.sel) < numRows {
551+
tmpSel := make([]int, numRows-len(p.sel))
552+
for i := 0; i < len(tmpSel); i++ {
553+
tmpSel[i] = i + len(p.sel)
554+
}
555+
p.sel = append(p.sel, tmpSel...)
556+
}
557+
548558
// All rows is selected, sel will be [0....numRows).
549559
// e.sel is setup when building executor.
550560
sel = p.sel

0 commit comments

Comments
 (0)