diff --git a/statistics/cmsketch.go b/statistics/cmsketch.go index 3c0abfdd54275..e36cdfaef949e 100644 --- a/statistics/cmsketch.go +++ b/statistics/cmsketch.go @@ -834,6 +834,9 @@ func MergePartTopN2GlobalTopN(loc *time.Location, version int, topNs []*TopN, n // 1. Check the topN first. // 2. If the topN doesn't contain the value corresponding to encodedVal. We should check the histogram. for j := 0; j < partNum; j++ { + if atomic.LoadUint32(kiiled) == 1 { + return nil, nil, nil, errors.Trace(ErrQueryInterrupted) + } if (j == i && version >= 2) || topNs[j].findTopN(val.Encoded) != -1 { continue }