diff --git a/executor/index_lookup_hash_join.go b/executor/index_lookup_hash_join.go index 503dad70a8731..400a2b1d91638 100644 --- a/executor/index_lookup_hash_join.go +++ b/executor/index_lookup_hash_join.go @@ -498,7 +498,9 @@ func (iw *indexHashJoinInnerWorker) run(ctx context.Context, cancelFunc context. break } err := iw.handleTask(ctx, task, joinResult, h, resultCh) - if err != nil { + if err != nil && !task.keepOuterOrder { + // Only need check non-keep-outer-order case because the + // `joinResult` had been sent to the `resultCh` when err != nil. joinResult.err = err break }