Skip to content

Commit

Permalink
statistics: remove unnecessary copy in the baseCollector (#51244)
Browse files Browse the repository at this point in the history
close #51246
  • Loading branch information
hawkingrei authored Feb 22, 2024
1 parent f4013a3 commit 8f2428e
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions pkg/statistics/row_sampler.go
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down

0 comments on commit 8f2428e

Please sign in to comment.