diff --git a/executor/index_lookup_hash_join.go b/executor/index_lookup_hash_join.go index 2ccba4c891f18..9d83ae81da2c8 100644 --- a/executor/index_lookup_hash_join.go +++ b/executor/index_lookup_hash_join.go @@ -620,7 +620,10 @@ func (iw *indexHashJoinInnerWorker) handleTask(ctx context.Context, task *indexH if task.keepOuterOrder { if err != nil { joinResult.err = err - resultCh <- joinResult + select { + case <-ctx.Done(): + case resultCh <- joinResult: + } } close(resultCh) }