From d22f9bca98c17adecd6137c903b9bf9e5a25e77f Mon Sep 17 00:00:00 2001 From: Ti Chi Robot Date: Thu, 10 Aug 2023 10:27:26 +0800 Subject: [PATCH] statistics: remove useless code in the MergePartTopN2GlobalTopN (#45755) (#45770) close pingcap/tidb#45706 --- statistics/cmsketch.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/statistics/cmsketch.go b/statistics/cmsketch.go index 938cb30aa67e2..9c5c8bfdfa547 100644 --- a/statistics/cmsketch.go +++ b/statistics/cmsketch.go @@ -745,15 +745,8 @@ func MergePartTopN2GlobalTopN(loc *time.Location, version int, topNs []*TopN, n } partNum := len(topNs) - topNsNum := make([]int, partNum) removeVals := make([][]TopNMeta, partNum) - for i, topN := range topNs { - if topN == nil { - topNsNum[i] = 0 - continue - } - topNsNum[i] = len(topN.TopN) - } + // Different TopN structures may hold the same value, we have to merge them. counter := make(map[hack.MutableString]float64) // datumMap is used to store the mapping from the string type to datum type.