diff --git a/go-tipb/analyze.pb.go b/go-tipb/analyze.pb.go index 69eba673..e96b6f2b 100644 --- a/go-tipb/analyze.pb.go +++ b/go-tipb/analyze.pb.go @@ -335,7 +335,12 @@ type AnalyzeColumnsReq struct { ColumnGroups []*AnalyzeColumnGroup `protobuf:"bytes,10,rep,name=column_groups,json=columnGroups" json:"column_groups,omitempty"` // sample_rate is the sampling rate that how many samples will collected. // There must be one non-zero value in sample_rate and sample_size. - SampleRate *float64 `protobuf:"fixed64,11,opt,name=sample_rate,json=sampleRate" json:"sample_rate,omitempty"` + SampleRate *float64 `protobuf:"fixed64,11,opt,name=sample_rate,json=sampleRate" json:"sample_rate,omitempty"` + // ndv_rate is the probability that the server keeps a row for NDV. If it is + // absent, the server keeps all rows. The server takes samples only from the + // kept rows, so ndv_rate must not be less than sample_rate. A server that + // does not support ndv_rate ignores it. + NdvRate *float64 `protobuf:"fixed64,12,opt,name=ndv_rate,json=ndvRate" json:"ndv_rate,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -421,6 +426,13 @@ func (m *AnalyzeColumnsReq) GetSampleRate() float64 { return 0 } +func (m *AnalyzeColumnsReq) GetNdvRate() float64 { + if m != nil && m.NdvRate != nil { + return *m.NdvRate + } + return 0 +} + type AnalyzeMixedResp struct { ColumnsResp *AnalyzeColumnsResp `protobuf:"bytes,1,opt,name=columns_resp,json=columnsResp" json:"columns_resp,omitempty"` IndexResp *AnalyzeIndexResp `protobuf:"bytes,2,opt,name=index_resp,json=indexResp" json:"index_resp,omitempty"` @@ -618,8 +630,12 @@ func (m *Histogram) GetBuckets() []*Bucket { // FMSketch is used to count distinct values for columns. type FMSketch struct { - Mask uint64 `protobuf:"varint,1,opt,name=mask" json:"mask"` - Hashset []uint64 `protobuf:"varint,2,rep,name=hashset" json:"hashset,omitempty"` + Mask uint64 `protobuf:"varint,1,opt,name=mask" json:"mask"` + Hashset []uint64 `protobuf:"varint,2,rep,name=hashset" json:"hashset,omitempty"` + // multi_hashset is used only when RowSampleCollector.ndv_sample_count is + // set. It has the hashes seen more than once, and hashset then has only the + // hashes seen once, because the NDV estimate scales up only those. + MultiHashset []uint64 `protobuf:"varint,3,rep,name=multi_hashset,json=multiHashset" json:"multi_hashset,omitempty"` XXX_unrecognized []byte `json:"-"` } @@ -642,6 +658,13 @@ func (m *FMSketch) GetHashset() []uint64 { return nil } +func (m *FMSketch) GetMultiHashset() []uint64 { + if m != nil { + return m.MultiHashset + } + return nil +} + // SampleCollector is used for collect samples and calculate the count and ndv of an column. type SampleCollector struct { Samples [][]byte `protobuf:"bytes,1,rep,name=samples" json:"samples,omitempty"` @@ -701,12 +724,19 @@ func (m *SampleCollector) GetTotalSize() int64 { } type RowSampleCollector struct { - Samples []*RowSample `protobuf:"bytes,1,rep,name=samples" json:"samples,omitempty"` - NullCounts []int64 `protobuf:"varint,2,rep,name=null_counts,json=nullCounts" json:"null_counts,omitempty"` - Count int64 `protobuf:"varint,3,opt,name=count" json:"count"` - FmSketch []*FMSketch `protobuf:"bytes,4,rep,name=fm_sketch,json=fmSketch" json:"fm_sketch,omitempty"` - TotalSize []int64 `protobuf:"varint,5,rep,name=total_size,json=totalSize" json:"total_size,omitempty"` - XXX_unrecognized []byte `json:"-"` + Samples []*RowSample `protobuf:"bytes,1,rep,name=samples" json:"samples,omitempty"` + NullCounts []int64 `protobuf:"varint,2,rep,name=null_counts,json=nullCounts" json:"null_counts,omitempty"` + Count int64 `protobuf:"varint,3,opt,name=count" json:"count"` + FmSketch []*FMSketch `protobuf:"bytes,4,rep,name=fm_sketch,json=fmSketch" json:"fm_sketch,omitempty"` + TotalSize []int64 `protobuf:"varint,5,rep,name=total_size,json=totalSize" json:"total_size,omitempty"` + // ndv_sample_count is the number of rows that the server kept for NDV. The + // server sets it only when AnalyzeColumnsReq.ndv_rate is less than 1, even + // if it kept no rows. The count field includes the rows that were not kept, + // and the server scales null_counts and total_size up to match count. If + // ndv_sample_count is 0, there is nothing to scale: null_counts and + // total_size are 0 and do not describe the rows in count. + NdvSampleCount *int64 `protobuf:"varint,8,opt,name=ndv_sample_count,json=ndvSampleCount" json:"ndv_sample_count,omitempty"` + XXX_unrecognized []byte `json:"-"` } func (m *RowSampleCollector) Reset() { *m = RowSampleCollector{} } @@ -749,6 +779,13 @@ func (m *RowSampleCollector) GetTotalSize() []int64 { return nil } +func (m *RowSampleCollector) GetNdvSampleCount() int64 { + if m != nil && m.NdvSampleCount != nil { + return *m.NdvSampleCount + } + return 0 +} + type RowSample struct { Row [][]byte `protobuf:"bytes,1,rep,name=row" json:"row,omitempty"` Weight int64 `protobuf:"varint,2,opt,name=weight" json:"weight"` @@ -1059,6 +1096,12 @@ func (m *AnalyzeColumnsReq) MarshalTo(dAtA []byte) (int, error) { encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.SampleRate)))) i += 8 } + if m.NdvRate != nil { + dAtA[i] = 0x61 + i++ + encoding_binary.LittleEndian.PutUint64(dAtA[i:], uint64(math.Float64bits(float64(*m.NdvRate)))) + i += 8 + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1350,6 +1393,13 @@ func (m *FMSketch) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintAnalyze(dAtA, i, uint64(num)) } } + if len(m.MultiHashset) > 0 { + for _, num := range m.MultiHashset { + dAtA[i] = 0x18 + i++ + i = encodeVarintAnalyze(dAtA, i, uint64(num)) + } + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1472,6 +1522,11 @@ func (m *RowSampleCollector) MarshalTo(dAtA []byte) (int, error) { i = encodeVarintAnalyze(dAtA, i, uint64(num)) } } + if m.NdvSampleCount != nil { + dAtA[i] = 0x40 + i++ + i = encodeVarintAnalyze(dAtA, i, uint64(*m.NdvSampleCount)) + } if m.XXX_unrecognized != nil { i += copy(dAtA[i:], m.XXX_unrecognized) } @@ -1713,6 +1768,9 @@ func (m *AnalyzeColumnsReq) Size() (n int) { if m.SampleRate != nil { n += 9 } + if m.NdvRate != nil { + n += 9 + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1846,6 +1904,11 @@ func (m *FMSketch) Size() (n int) { n += 1 + sovAnalyze(uint64(e)) } } + if len(m.MultiHashset) > 0 { + for _, e := range m.MultiHashset { + n += 1 + sovAnalyze(uint64(e)) + } + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -1906,6 +1969,9 @@ func (m *RowSampleCollector) Size() (n int) { n += 1 + sovAnalyze(uint64(e)) } } + if m.NdvSampleCount != nil { + n += 1 + sovAnalyze(uint64(*m.NdvSampleCount)) + } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) } @@ -2736,6 +2802,18 @@ func (m *AnalyzeColumnsReq) Unmarshal(dAtA []byte) error { iNdEx += 8 v2 := float64(math.Float64frombits(v)) m.SampleRate = &v2 + case 12: + if wireType != 1 { + return fmt.Errorf("proto: wrong wireType = %d for field NdvRate", wireType) + } + var v uint64 + if (iNdEx + 8) > l { + return io.ErrUnexpectedEOF + } + v = uint64(encoding_binary.LittleEndian.Uint64(dAtA[iNdEx:])) + iNdEx += 8 + v2 := float64(math.Float64frombits(v)) + m.NdvRate = &v2 default: iNdEx = preIndex skippy, err := skipAnalyze(dAtA[iNdEx:]) @@ -3730,6 +3808,68 @@ func (m *FMSketch) Unmarshal(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field Hashset", wireType) } + case 3: + if wireType == 0 { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnalyze + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.MultiHashset = append(m.MultiHashset, v) + } else if wireType == 2 { + var packedLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnalyze + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + packedLen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if packedLen < 0 { + return ErrInvalidLengthAnalyze + } + postIndex := iNdEx + packedLen + if postIndex > l { + return io.ErrUnexpectedEOF + } + for iNdEx < postIndex { + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnalyze + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.MultiHashset = append(m.MultiHashset, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field MultiHashset", wireType) + } default: iNdEx = preIndex skippy, err := skipAnalyze(dAtA[iNdEx:]) @@ -4190,6 +4330,26 @@ func (m *RowSampleCollector) Unmarshal(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field TotalSize", wireType) } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field NdvSampleCount", wireType) + } + var v int64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnalyze + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + m.NdvSampleCount = &v default: iNdEx = preIndex skippy, err := skipAnalyze(dAtA[iNdEx:]) @@ -4765,83 +4925,87 @@ var ( func init() { proto.RegisterFile("analyze.proto", fileDescriptorAnalyze) } var fileDescriptorAnalyze = []byte{ - // 1244 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0x5f, 0x6f, 0xdc, 0x44, - 0x10, 0xaf, 0xcf, 0xf7, 0x77, 0xee, 0x92, 0x5c, 0x96, 0xb6, 0x98, 0xa8, 0xa4, 0x27, 0x57, 0xa5, - 0x97, 0x16, 0x1d, 0x28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0x9d, 0xf2, 0x94, 0x79, 0x7c, - 0x3c, 0x16, 0x4c, 0x3a, 0xf5, 0x81, 0x35, 0xb4, 0x0d, 0x6c, 0x53, 0x59, 0xbf, 0xe7, 0x29, 0xfb, - 0x06, 0x6d, 0x64, 0x04, 0xad, 0x28, 0x3c, 0xf1, 0x72, 0x76, 0xec, 0x34, 0x06, 0xd6, 0xb0, 0xbb, - 0x7f, 0x69, 0x29, 0xca, 0x87, 0x69, 0xc8, 0x4e, 0x28, 0x3b, 0xa6, 0xcd, 0x28, 0x54, 0x5f, 0xf2, - 0x31, 0xb4, 0x02, 0x1e, 0x23, 0xbe, 0x89, 0xf8, 0x77, 0x97, 0xf0, 0xf7, 0x78, 0x5c, 0x24, 0xa9, - 0xc0, 0x1d, 0x01, 0x8f, 0x29, 0x3b, 0x76, 0x7f, 0xad, 0xc1, 0xd6, 0x8a, 0x37, 0x72, 0x1d, 0xba, - 0x87, 0x45, 0x70, 0xc4, 0xa4, 0x27, 0xa2, 0x53, 0x86, 0xfc, 0x94, 0x01, 0x82, 0x36, 0x3c, 0x8d, - 0x4e, 0x99, 0x82, 0xa5, 0x45, 0xe2, 0x05, 0xda, 0x29, 0xd2, 0xd1, 0x28, 0x61, 0x69, 0x91, 0x98, - 0xc3, 0xc8, 0x75, 0xd8, 0x0c, 0x12, 0x71, 0xc4, 0x64, 0x30, 0xf5, 0x42, 0x96, 0xc9, 0x29, 0x12, - 0xd3, 0xa0, 0x1b, 0xa5, 0xf6, 0x0b, 0xa5, 0x5c, 0x82, 0xcd, 0xa2, 0x50, 0x4e, 0x91, 0x98, 0x05, - 0xd8, 0x77, 0x4a, 0xa9, 0x0e, 0x15, 0x7e, 0x92, 0xc5, 0x4c, 0xc7, 0xd6, 0x58, 0x8c, 0x4d, 0x1b, - 0xca, 0xd8, 0x8c, 0x2f, 0x84, 0x35, 0x97, 0x60, 0x68, 0x40, 0xd8, 0x15, 0x00, 0xc9, 0x33, 0x2f, - 0xd5, 0xa8, 0x16,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0xfe, 0x4c, 0xa1, 0xf0, 0x55, 0x09, 0x70, - 0xf3, 0x27, 0x00, 0x91, 0xba, 0x70, 0x7a, 0x6b, 0x0d, 0xb7, 0x5e, 0x5e, 0x77, 0xbb, 0x45, 0x46, - 0x3b, 0x51, 0xb9, 0x74, 0x0f, 0x81, 0x9c, 0xcd, 0x06, 0x0b, 0xa5, 0xd3, 0xd7, 0x43, 0x45, 0x38, - 0x16, 0xd2, 0x65, 0x48, 0xd1, 0xd3, 0x04, 0xaf, 0xa2, 0x21, 0x36, 0x66, 0xe9, 0x44, 0x4e, 0xd5, - 0xa5, 0x45, 0x98, 0xd6, 0x7e, 0xad, 0x95, 0xee, 0x6f, 0xd6, 0xca, 0x21, 0x55, 0xc4, 0x01, 0x8f, - 0x63, 0x16, 0x48, 0x9e, 0xeb, 0x03, 0xaa, 0x79, 0xf4, 0x14, 0x99, 0xba, 0x57, 0x5a, 0xe9, 0x02, - 0x90, 0x0c, 0xa1, 0x95, 0x1d, 0x79, 0xd3, 0x48, 0x48, 0x93, 0xe5, 0x96, 0xde, 0xf3, 0x20, 0x12, - 0x92, 0x4f, 0x72, 0x3f, 0xa1, 0xcd, 0xec, 0x48, 0x09, 0xaa, 0x88, 0x39, 0x9f, 0x79, 0xd5, 0x5e, - 0xec, 0xf9, 0x8a, 0x50, 0xca, 0x67, 0xab, 0xc7, 0xf4, 0x72, 0x3e, 0xab, 0x24, 0xf7, 0xe7, 0x79, - 0x8d, 0x2a, 0xea, 0xc8, 0x35, 0xa8, 0xe3, 0xd1, 0xd6, 0xfa, 0xa3, 0xd1, 0x48, 0x06, 0x60, 0x07, - 0x89, 0x30, 0xe1, 0x6d, 0x9a, 0xab, 0xf3, 0xe8, 0x29, 0xb6, 0x38, 0x55, 0x26, 0x72, 0x1b, 0x3a, - 0xab, 0x61, 0x9d, 0x93, 0xfa, 0x1c, 0xe7, 0xbe, 0xb4, 0xa0, 0x79, 0x80, 0xf7, 0x5e, 0x3d, 0x0a, - 0x01, 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6, 0x0f, 0xd0, 0x5d, 0xf8, - 0xbf, 0x24, 0x1b, 0xd0, 0x51, 0x5f, 0x1c, 0x56, 0xfd, 0x0b, 0x64, 0x13, 0x40, 0x89, 0x7a, 0xe4, - 0xf6, 0x2d, 0x72, 0x11, 0xfa, 0x5a, 0x4e, 0x12, 0x9e, 0x3e, 0xf0, 0xd3, 0x30, 0x66, 0xfd, 0x1a, - 0x79, 0x07, 0xb6, 0x94, 0x56, 0x93, 0xae, 0xb7, 0xda, 0xa5, 0x27, 0x7c, 0x9a, 0xfa, 0xf5, 0x72, - 0xe7, 0xfd, 0x22, 0x8e, 0x11, 0x17, 0xa5, 0x93, 0x7e, 0xe3, 0x60, 0xef, 0xd5, 0xeb, 0x5d, 0xeb, - 0x8f, 0xd7, 0xbb, 0xd6, 0x5f, 0xaf, 0x77, 0xad, 0x97, 0x7f, 0xef, 0x5e, 0x80, 0x4b, 0x01, 0x4f, - 0x46, 0x59, 0x94, 0x4e, 0x02, 0x3f, 0x1b, 0xc9, 0x28, 0x3c, 0xc4, 0x24, 0x9f, 0x58, 0xff, 0x05, - 0x00, 0x00, 0xff, 0xff, 0x3c, 0xd9, 0x10, 0xfc, 0x61, 0x0b, 0x00, 0x00, + // 1310 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xdd, 0x6e, 0xdb, 0xc6, + 0x12, 0x0e, 0x25, 0xea, 0x6f, 0x24, 0xdb, 0xf4, 0x9e, 0x24, 0x87, 0x31, 0x72, 0x1c, 0x81, 0x41, + 0x4e, 0xe4, 0xa4, 0x70, 0x0b, 0x07, 0xbd, 0x28, 0x82, 0x16, 0xa8, 0x53, 0xa4, 0x49, 0xda, 0xa4, + 0xc1, 0x26, 0x68, 0x81, 0xde, 0x10, 0x34, 0xb9, 0x92, 0x08, 0x93, 0x5c, 0x9a, 0xbb, 0xb4, 0x1c, + 0xa3, 0x97, 0x6d, 0x81, 0xde, 0xb4, 0xb7, 0x79, 0x8f, 0xf6, 0x21, 0x72, 0xd9, 0x27, 0x28, 0x8a, + 0x14, 0x7d, 0x8f, 0x62, 0x67, 0x97, 0x94, 0x64, 0x2b, 0x45, 0x72, 0x25, 0xee, 0x7c, 0xdf, 0xce, + 0xce, 0x7c, 0x33, 0x3b, 0x2b, 0x58, 0x0b, 0xb2, 0x20, 0x79, 0x71, 0xca, 0x76, 0xf3, 0x82, 0x4b, + 0x4e, 0x6c, 0x19, 0xe7, 0x07, 0x5b, 0x03, 0x11, 0x4e, 0x59, 0x1a, 0x68, 0xdb, 0xd6, 0xc5, 0x09, + 0x9f, 0x70, 0xfc, 0x7c, 0x5f, 0x7d, 0x69, 0xab, 0xf7, 0x4b, 0x03, 0xe0, 0x53, 0xbd, 0x97, 0xb2, + 0x23, 0x72, 0x13, 0x1a, 0x32, 0x77, 0xad, 0xa1, 0x35, 0x5a, 0xdf, 0xdb, 0xdc, 0x55, 0x5e, 0x76, + 0x0d, 0xfa, 0xfc, 0x45, 0xce, 0xf6, 0xed, 0x57, 0x7f, 0x5c, 0xbb, 0x40, 0x1b, 0x32, 0x27, 0xb7, + 0x60, 0x53, 0xc8, 0xa0, 0x90, 0xbe, 0x14, 0xfe, 0x38, 0x48, 0x92, 0x83, 0x20, 0x3c, 0x74, 0x1b, + 0x43, 0x6b, 0x64, 0xd3, 0x0d, 0x04, 0x9e, 0x8b, 0xfb, 0xc6, 0x4c, 0xb6, 0xa0, 0x35, 0x4e, 0x82, + 0x89, 0x70, 0x9b, 0x0a, 0x37, 0x4e, 0xb4, 0x89, 0xec, 0x82, 0x23, 0xe3, 0x94, 0xf9, 0xa7, 0x3c, + 0x63, 0x3e, 0x1f, 0x8f, 0x05, 0x93, 0xae, 0x3d, 0xb4, 0x46, 0x4d, 0x43, 0x5b, 0x57, 0xe8, 0xb7, + 0x3c, 0x63, 0x5f, 0x21, 0x46, 0x76, 0xa1, 0x13, 0x47, 0x27, 0x7e, 0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21, 0x31, 0xb7, 0x8a, 0x2c, + 0xf3, 0x54, 0x18, 0xd4, 0x56, 0xff, 0x4f, 0xc8, 0x0e, 0xac, 0x45, 0x6c, 0x1c, 0x94, 0x89, 0xf4, + 0x8f, 0x83, 0xa4, 0x64, 0x4b, 0xff, 0x36, 0x07, 0x06, 0xfa, 0x5a, 0x21, 0xb7, 0xbe, 0x83, 0xfe, + 0xc2, 0xbf, 0x5a, 0xb2, 0x06, 0x3d, 0xf5, 0x8b, 0x73, 0xd0, 0xb9, 0x40, 0xd6, 0x01, 0xd4, 0x52, + 0x4f, 0x73, 0xc7, 0x22, 0x17, 0xc1, 0xd1, 0xeb, 0x34, 0xe5, 0xd9, 0x83, 0x20, 0x8b, 0x12, 0xe6, + 0x34, 0xc8, 0x7f, 0x60, 0x43, 0x59, 0xb5, 0xe8, 0x7a, 0x6b, 0xb3, 0xf2, 0x84, 0xaf, 0x9e, 0x63, + 0x57, 0x3b, 0xef, 0x97, 0x49, 0x82, 0xbc, 0x38, 0x9b, 0x38, 0xad, 0xfd, 0x9d, 0x57, 0xaf, 0xb7, + 0xad, 0xdf, 0x5f, 0x6f, 0x5b, 0x7f, 0xbe, 0xde, 0xb6, 0x5e, 0xfe, 0xb5, 0x7d, 0x01, 0x2e, 0x85, + 0x3c, 0xdd, 0xcd, 0xe3, 0x6c, 0x12, 0x06, 0xf9, 0xae, 0x8c, 0xa3, 0x03, 0x4c, 0xf2, 0xa9, 0xf5, + 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x67, 0x1e, 0xd9, 0x50, 0xd7, 0x0b, 0x00, 0x00, } diff --git a/proto/analyze.proto b/proto/analyze.proto index 2280106f..88590113 100644 --- a/proto/analyze.proto +++ b/proto/analyze.proto @@ -79,6 +79,12 @@ message AnalyzeColumnsReq { // sample_rate is the sampling rate that how many samples will collected. // There must be one non-zero value in sample_rate and sample_size. optional double sample_rate = 11; + + // ndv_rate is the probability that the server keeps a row for NDV. If it is + // absent, the server keeps all rows. The server takes samples only from the + // kept rows, so ndv_rate must not be less than sample_rate. A server that + // does not support ndv_rate ignores it. + optional double ndv_rate = 12; } message AnalyzeMixedResp { @@ -129,6 +135,10 @@ message Histogram { message FMSketch { optional uint64 mask = 1 [(gogoproto.nullable) = false]; repeated uint64 hashset = 2; + // multi_hashset is used only when RowSampleCollector.ndv_sample_count is + // set. It has the hashes seen more than once, and hashset then has only the + // hashes seen once, because the NDV estimate scales up only those. + repeated uint64 multi_hashset = 3; } // SampleCollector is used for collect samples and calculate the count and ndv of an column. @@ -147,6 +157,14 @@ message RowSampleCollector { optional int64 count = 3 [(gogoproto.nullable) = false]; repeated FMSketch fm_sketch = 4; repeated int64 total_size = 5; + reserved 6, 7; + // ndv_sample_count is the number of rows that the server kept for NDV. The + // server sets it only when AnalyzeColumnsReq.ndv_rate is less than 1, even + // if it kept no rows. The count field includes the rows that were not kept, + // and the server scales null_counts and total_size up to match count. If + // ndv_sample_count is 0, there is nothing to scale: null_counts and + // total_size are 0 and do not describe the rows in count. + optional int64 ndv_sample_count = 8; } message RowSample { diff --git a/scripts/proto.lock b/scripts/proto.lock index 377fc90b..59284f2a 100644 --- a/scripts/proto.lock +++ b/scripts/proto.lock @@ -256,6 +256,12 @@ "name": "sample_rate", "type": "double", "optional": true + }, + { + "id": 12, + "name": "ndv_rate", + "type": "double", + "optional": true } ] }, @@ -429,6 +435,12 @@ "name": "hashset", "type": "uint64", "is_repeated": true + }, + { + "id": 3, + "name": "multi_hashset", + "type": "uint64", + "is_repeated": true } ] }, @@ -529,7 +541,17 @@ "name": "total_size", "type": "int64", "is_repeated": true + }, + { + "id": 8, + "name": "ndv_sample_count", + "type": "int64", + "optional": true } + ], + "reserved_ids": [ + 6, + 7 ] }, {