code: func SampleCollectorFromProto(collector *tipb.SampleCollector) *SampleCollector {
  	s := &SampleCollector{
  		NullCount: collector.NullCount,
  		Count:     collector.Count,
  		FMSketch:  FMSketchFromProto(collector.FmSketch),
  	}
  	if collector.TotalSize != nil {
  		s.TotalSize = *collector.TotalSize
  	}
  	s.CMSketch = CMSketchFromProto(collector.CmSketch)
  	for _, val := range collector.Samples {
  		// When store the histogram bucket boundaries to kv, we need to limit the length of the value.
  		if len(val) <= maxSampleValueLength {
  			item := &SampleItem{Value: types.NewBytesDatum(val)}
  			s.Samples = append(s.Samples, item)
  		}
  	}
  	return s
  }
docs: // SampleCollectorFromProto converts SampleCollector from its protobuf representation.