code: func HistogramToProto(hg *Histogram) *tipb.Histogram {
  	protoHg := &tipb.Histogram{
  		Ndv: hg.NDV,
  	}
  	for i := 0; i < hg.Len(); i++ {
  		bkt := &tipb.Bucket{
  			Count:      hg.Buckets[i].Count,
  			LowerBound: hg.GetLower(i).GetBytes(),
  			UpperBound: hg.GetUpper(i).GetBytes(),
  			Repeats:    hg.Buckets[i].Repeat,
  		}
  		protoHg.Buckets = append(protoHg.Buckets, bkt)
  	}
  	return protoHg
  }
docs: // HistogramToProto converts Histogram to its protobuf representation.
  // Note that when this is used, the lower/upper bound in the bucket must be BytesDatum.