Skip to content

Commit

Permalink
executor: avoid initializing chunk with max chunk size in some places
Browse files Browse the repository at this point in the history
  • Loading branch information
tiancaiamao committed Jan 3, 2024
1 parent b50b151 commit 4b77cbc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkg/executor/index_lookup_hash_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ func (e *IndexNestedLoopHashJoin) newInnerWorker(taskCh chan *indexHashJoinTask,
innerCtx: e.innerCtx,
outerCtx: e.outerCtx,
ctx: e.Ctx(),
executorChk: e.AllocPool.Alloc(e.innerCtx.rowTypes, e.MaxChunkSize(), e.MaxChunkSize()),
executorChk: e.AllocPool.Alloc(e.innerCtx.rowTypes, e.InitCap(), e.MaxChunkSize()),
indexRanges: copiedRanges,
keyOff2IdxOff: e.keyOff2IdxOff,
stats: innerStats,
Expand Down
4 changes: 2 additions & 2 deletions pkg/executor/index_lookup_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ func (e *IndexLookUpJoin) newInnerWorker(taskCh chan *lookUpJoinTask) *innerWork
outerCtx: e.outerCtx,
taskCh: taskCh,
ctx: e.Ctx(),
executorChk: e.AllocPool.Alloc(e.innerCtx.rowTypes, e.MaxChunkSize(), e.MaxChunkSize()),
executorChk: e.AllocPool.Alloc(e.innerCtx.rowTypes, e.InitCap(), e.MaxChunkSize()),
indexRanges: copiedRanges,
keyOff2IdxOff: e.keyOff2IdxOff,
stats: innerStats,
Expand Down Expand Up @@ -437,7 +437,7 @@ func (ow *outerWorker) buildTask(ctx context.Context) (*lookUpJoinTask, error) {
}
maxChunkSize := ow.ctx.GetSessionVars().MaxChunkSize
for requiredRows > task.outerResult.Len() {
chk := ow.executor.NewChunkWithCapacity(ow.outerCtx.rowTypes, maxChunkSize, maxChunkSize)
chk := ow.executor.NewChunkWithCapacity(ow.outerCtx.rowTypes, requiredRows, maxChunkSize)
chk = chk.SetRequiredRows(requiredRows, maxChunkSize)
err := exec.Next(ctx, ow.executor, chk)
if err != nil {
Expand Down

0 comments on commit 4b77cbc

Please sign in to comment.