From a436635d4d7ed97a5e705f99ab3be0e4510b69d2 Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Wed, 2 Aug 2023 15:12:07 +0800 Subject: [PATCH] statistics: remove useless code in the MergePartTopN2GlobalTopN Signed-off-by: Weizhen Wang --- statistics/cmsketch.go | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/statistics/cmsketch.go b/statistics/cmsketch.go index a94bf501271c6..31abbbc6dc458 100644 --- a/statistics/cmsketch.go +++ b/statistics/cmsketch.go @@ -801,15 +801,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.