Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#48839
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
guo-shaoge authored and ti-chi-bot committed Nov 29, 2023
1 parent 877198d commit 617f6ce
Show file tree
Hide file tree
Showing 3 changed files with 580 additions and 0 deletions.
10 changes: 10 additions & 0 deletions executor/cte.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,16 @@ func (p *cteProducer) computeChunkHash(chk *chunk.Chunk) (sel []int, err error)
hashBitMap[val] = true
}
} else {
// Length of p.sel is init as MaxChunkSize, but the row num of chunk may still exceeds MaxChunkSize.
// So needs to handle here to make sure len(p.sel) == chk.NumRows().
if len(p.sel) < numRows {
tmpSel := make([]int, numRows-len(p.sel))
for i := 0; i < len(tmpSel); i++ {
tmpSel[i] = i + len(p.sel)
}
p.sel = append(p.sel, tmpSel...)
}

// All rows is selected, sel will be [0....numRows).
// e.sel is setup when building executor.
sel = p.sel
Expand Down
Loading

0 comments on commit 617f6ce

Please sign in to comment.