From 259666e44dbc61ff0962a7533ac774f83c46aba6 Mon Sep 17 00:00:00 2001 From: "Zhuomin(Charming) Liu" Date: Tue, 10 Nov 2020 14:25:17 +0800 Subject: [PATCH] cherry pick #20581 to release-4.0 Signed-off-by: ti-srebot --- executor/index_lookup_merge_join.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/executor/index_lookup_merge_join.go b/executor/index_lookup_merge_join.go index 38fc9794378b7..cfd3f29e0a7b1 100644 --- a/executor/index_lookup_merge_join.go +++ b/executor/index_lookup_merge_join.go @@ -558,6 +558,9 @@ func (imw *innerMergeWorker) doMergeJoin(ctx context.Context, task *lookUpMergeJ for _, outerIdx := range task.outerOrderIdx { outerRow := task.outerResult.GetRow(outerIdx) hasMatch, hasNull, cmpResult := false, false, initCmpResult + if task.outerMatch != nil && !task.outerMatch[outerIdx.ChkIdx][outerIdx.RowIdx] { + goto missMatch + } // If it has iterated out all inner rows and the inner rows with same key is empty, // that means the outer row needn't match any inner rows. if noneInnerRowsRemain && len(task.sameKeyInnerRows) == 0 {