From fe383c42f9bd3f15f07c225de0d80f241426a17a Mon Sep 17 00:00:00 2001 From: Weizhen Wang Date: Thu, 22 Feb 2024 16:18:12 +0800 Subject: [PATCH] statistics: remove unnecessary copy in the baseCollector Signed-off-by: Weizhen Wang --- pkg/statistics/row_sampler.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/statistics/row_sampler.go b/pkg/statistics/row_sampler.go index 50a8af7dbab09..4afcebcec3c69 100644 --- a/pkg/statistics/row_sampler.go +++ b/pkg/statistics/row_sampler.go @@ -317,9 +317,7 @@ func (s *baseCollector) FromProto(pbCollector *tipb.RowSampleCollector, memTrack rowLen := len(pbSample.Row) data := make([]types.Datum, 0, rowLen) for _, col := range pbSample.Row { - b := make([]byte, len(col)) - copy(b, col) - data = append(data, types.NewBytesDatum(b)) + data = append(data, types.NewBytesDatum(col)) } // Directly copy the weight. sampleItem := &ReservoirRowSampleItem{Columns: data, Weight: pbSample.Weight}