From 6ae1d47e641ec6baad9fd4a0c0e1eaa0eede6d92 Mon Sep 17 00:00:00 2001 From: 0xPoe Date: Sun, 1 Mar 2026 19:42:10 +0100 Subject: [PATCH] feat: sampling with hll Signed-off-by: 0xPoe --- go-tipb/analyze.pb.go | 559 +++++++++++++++++++++++++++++++++++------- proto/analyze.proto | 8 + 2 files changed, 474 insertions(+), 93 deletions(-) diff --git a/go-tipb/analyze.pb.go b/go-tipb/analyze.pb.go index cd2817b8..79197a62 100644 --- a/go-tipb/analyze.pb.go +++ b/go-tipb/analyze.pb.go @@ -806,21 +806,75 @@ func (m *FMSketch) GetHashset() []uint64 { return nil } +// HllSketch is used to estimate NDV with HyperLogLog. +type HllSketch struct { + BucketBits uint32 `protobuf:"varint,1,opt,name=bucket_bits,json=bucketBits" json:"bucket_bits"` + Registers []uint32 `protobuf:"varint,2,rep,name=registers" json:"registers,omitempty"` +} + +func (m *HllSketch) Reset() { *m = HllSketch{} } +func (m *HllSketch) String() string { return proto.CompactTextString(m) } +func (*HllSketch) ProtoMessage() {} +func (*HllSketch) Descriptor() ([]byte, []int) { + return fileDescriptor_76c3eb6de5a1604f, []int{10} +} +func (m *HllSketch) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HllSketch) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_HllSketch.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *HllSketch) XXX_Merge(src proto.Message) { + xxx_messageInfo_HllSketch.Merge(m, src) +} +func (m *HllSketch) XXX_Size() int { + return m.Size() +} +func (m *HllSketch) XXX_DiscardUnknown() { + xxx_messageInfo_HllSketch.DiscardUnknown(m) +} + +var xxx_messageInfo_HllSketch proto.InternalMessageInfo + +func (m *HllSketch) GetBucketBits() uint32 { + if m != nil { + return m.BucketBits + } + return 0 +} + +func (m *HllSketch) GetRegisters() []uint32 { + if m != nil { + return m.Registers + } + 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"` - NullCount int64 `protobuf:"varint,2,opt,name=null_count,json=nullCount" json:"null_count"` - Count int64 `protobuf:"varint,3,opt,name=count" json:"count"` - FmSketch *FMSketch `protobuf:"bytes,4,opt,name=fm_sketch,json=fmSketch" json:"fm_sketch,omitempty"` - CmSketch *CMSketch `protobuf:"bytes,5,opt,name=cm_sketch,json=cmSketch" json:"cm_sketch,omitempty"` - TotalSize *int64 `protobuf:"varint,6,opt,name=total_size,json=totalSize" json:"total_size,omitempty"` + Samples [][]byte `protobuf:"bytes,1,rep,name=samples" json:"samples,omitempty"` + NullCount int64 `protobuf:"varint,2,opt,name=null_count,json=nullCount" json:"null_count"` + Count int64 `protobuf:"varint,3,opt,name=count" json:"count"` + FmSketch *FMSketch `protobuf:"bytes,4,opt,name=fm_sketch,json=fmSketch" json:"fm_sketch,omitempty"` + CmSketch *CMSketch `protobuf:"bytes,5,opt,name=cm_sketch,json=cmSketch" json:"cm_sketch,omitempty"` + TotalSize *int64 `protobuf:"varint,6,opt,name=total_size,json=totalSize" json:"total_size,omitempty"` + HllSketch *HllSketch `protobuf:"bytes,7,opt,name=hll_sketch,json=hllSketch" json:"hll_sketch,omitempty"` } func (m *SampleCollector) Reset() { *m = SampleCollector{} } func (m *SampleCollector) String() string { return proto.CompactTextString(m) } func (*SampleCollector) ProtoMessage() {} func (*SampleCollector) Descriptor() ([]byte, []int) { - return fileDescriptor_76c3eb6de5a1604f, []int{10} + return fileDescriptor_76c3eb6de5a1604f, []int{11} } func (m *SampleCollector) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -891,19 +945,27 @@ func (m *SampleCollector) GetTotalSize() int64 { return 0 } +func (m *SampleCollector) GetHllSketch() *HllSketch { + if m != nil { + return m.HllSketch + } + return nil +} + 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"` + HllSketch []*HllSketch `protobuf:"bytes,6,rep,name=hll_sketch,json=hllSketch" json:"hll_sketch,omitempty"` } func (m *RowSampleCollector) Reset() { *m = RowSampleCollector{} } func (m *RowSampleCollector) String() string { return proto.CompactTextString(m) } func (*RowSampleCollector) ProtoMessage() {} func (*RowSampleCollector) Descriptor() ([]byte, []int) { - return fileDescriptor_76c3eb6de5a1604f, []int{11} + return fileDescriptor_76c3eb6de5a1604f, []int{12} } func (m *RowSampleCollector) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -967,6 +1029,13 @@ func (m *RowSampleCollector) GetTotalSize() []int64 { return nil } +func (m *RowSampleCollector) GetHllSketch() []*HllSketch { + if m != nil { + return m.HllSketch + } + return nil +} + type RowSample struct { Row [][]byte `protobuf:"bytes,1,rep,name=row" json:"row,omitempty"` Weight int64 `protobuf:"varint,2,opt,name=weight" json:"weight"` @@ -976,7 +1045,7 @@ func (m *RowSample) Reset() { *m = RowSample{} } func (m *RowSample) String() string { return proto.CompactTextString(m) } func (*RowSample) ProtoMessage() {} func (*RowSample) Descriptor() ([]byte, []int) { - return fileDescriptor_76c3eb6de5a1604f, []int{12} + return fileDescriptor_76c3eb6de5a1604f, []int{13} } func (m *RowSample) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1027,7 +1096,7 @@ func (m *CMSketchRow) Reset() { *m = CMSketchRow{} } func (m *CMSketchRow) String() string { return proto.CompactTextString(m) } func (*CMSketchRow) ProtoMessage() {} func (*CMSketchRow) Descriptor() ([]byte, []int) { - return fileDescriptor_76c3eb6de5a1604f, []int{13} + return fileDescriptor_76c3eb6de5a1604f, []int{14} } func (m *CMSketchRow) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1072,7 +1141,7 @@ func (m *CMSketchTopN) Reset() { *m = CMSketchTopN{} } func (m *CMSketchTopN) String() string { return proto.CompactTextString(m) } func (*CMSketchTopN) ProtoMessage() {} func (*CMSketchTopN) Descriptor() ([]byte, []int) { - return fileDescriptor_76c3eb6de5a1604f, []int{14} + return fileDescriptor_76c3eb6de5a1604f, []int{15} } func (m *CMSketchTopN) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1125,7 +1194,7 @@ func (m *CMSketch) Reset() { *m = CMSketch{} } func (m *CMSketch) String() string { return proto.CompactTextString(m) } func (*CMSketch) ProtoMessage() {} func (*CMSketch) Descriptor() ([]byte, []int) { - return fileDescriptor_76c3eb6de5a1604f, []int{15} + return fileDescriptor_76c3eb6de5a1604f, []int{16} } func (m *CMSketch) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1187,6 +1256,7 @@ func init() { proto.RegisterType((*Bucket)(nil), "tipb.Bucket") proto.RegisterType((*Histogram)(nil), "tipb.Histogram") proto.RegisterType((*FMSketch)(nil), "tipb.FMSketch") + proto.RegisterType((*HllSketch)(nil), "tipb.HllSketch") proto.RegisterType((*SampleCollector)(nil), "tipb.SampleCollector") proto.RegisterType((*RowSampleCollector)(nil), "tipb.RowSampleCollector") proto.RegisterType((*RowSample)(nil), "tipb.RowSample") @@ -1198,87 +1268,91 @@ func init() { func init() { proto.RegisterFile("analyze.proto", fileDescriptor_76c3eb6de5a1604f) } var fileDescriptor_76c3eb6de5a1604f = []byte{ - // 1272 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcf, 0x6e, 0xdb, 0x46, - 0x13, 0x37, 0xf5, 0x5f, 0x23, 0xd9, 0x96, 0xf7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xa9, 0x30, 0x68, 0x4d, - 0xfd, 0x29, 0x90, 0x6b, 0xb0, 0x1e, 0xb0, 0xb1, 0x97, 0x47, 0xd2, 0x7d, 0xe6, 0x45, 0x39, 0x5b, - 0xfa, 0xef, 0xeb, 0x1a, 0xd3, 0x37, 0xca, 0x72, 0xfd, 0x7b, 0xe8, 0x2c, 0xfc, 0x5f, 0x92, 0x75, - 0x68, 0xab, 0x2f, 0x0e, 0xab, 0xde, 0x1a, 0xd9, 0x00, 0x50, 0xa2, 0x1e, 0xb9, 0x3d, 0x8b, 0x9c, - 0x83, 0x9e, 0x96, 0xe3, 0x98, 0x27, 0xf7, 0xbd, 0x24, 0x88, 0x58, 0xaf, 0x42, 0xfe, 0x07, 0x9b, - 0x4a, 0xab, 0x49, 0xd7, 0x5b, 0xab, 0x85, 0x27, 0x7c, 0x9a, 0x7a, 0xb5, 0x62, 0xe7, 0xbd, 0x3c, - 0x8a, 0x10, 0x17, 0x26, 0x93, 0x5e, 0x7d, 0xf7, 0xd6, 0xeb, 0x5f, 0x5b, 0xd6, 0xcb, 0x37, 0x7d, - 0xeb, 0xd5, 0x9b, 0xbe, 0xf5, 0xd7, 0x9b, 0xbe, 0xf5, 0xcb, 0x71, 0x7f, 0xed, 0xc5, 0x71, 0x7f, - 0xed, 0xd5, 0x71, 0x7f, 0xed, 0xf5, 0x71, 0x7f, 0x0d, 0xce, 0xfb, 0x3c, 0x1e, 0xa5, 0x61, 0x32, - 0xf1, 0xbd, 0x74, 0x24, 0xc3, 0x60, 0x0f, 0x93, 0x7e, 0x6c, 0xfd, 0x1b, 0x00, 0x00, 0xff, 0xff, - 0x10, 0xc3, 0x90, 0xb5, 0x82, 0x0b, 0x00, 0x00, + // 1331 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x56, 0xcf, 0x8f, 0xdb, 0xc4, + 0x17, 0x5f, 0xe7, 0x77, 0x5e, 0x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d0, 0x2d, 0x54, 0x3c, 0x15, 0xf7, + 0x8c, 0x98, 0xec, 0x40, 0x75, 0x1c, 0x79, 0x13, 0x61, 0x97, 0x95, 0xde, 0x18, 0xd1, 0x22, 0x32, + 0x84, 0xae, 0x0c, 0x63, 0xe6, 0x1e, 0xf1, 0x84, 0xb9, 0x7c, 0x3c, 0x16, 0x4c, 0xda, 0x95, 0xbe, + 0x35, 0x28, 0x1b, 0xd8, 0xa6, 0xd2, 0x7e, 0xc7, 0x13, 0xf6, 0x35, 0xea, 0xc8, 0x10, 0xea, 0x61, + 0x70, 0xe8, 0x66, 0xec, 0xc0, 0xae, 0xf6, 0xad, 0x41, 0x6b, 0xf7, 0xfc, 0x8a, 0x97, 0x0f, 0x92, + 0x80, 0x1d, 0x52, 0x76, 0x40, 0x6b, 0x61, 0xa0, 0xbe, 0xe4, 0x63, 0xa8, 0xfb, 0x3c, 0x42, 0x7c, + 0x0d, 0xf1, 0xff, 0x5f, 0xc1, 0xdf, 0xe5, 0xd1, 0x2c, 0x4e, 0x04, 0x9e, 0xf0, 0x79, 0x44, 0xd9, + 0x81, 0xf3, 0x7b, 0x09, 0xb6, 0x4e, 0x58, 0x23, 0x57, 0xa0, 0x35, 0x9a, 0xf9, 0xfb, 0x4c, 0xba, + 0x22, 0x3c, 0x62, 0xc8, 0x4f, 0xee, 0x20, 0x68, 0xc5, 0x93, 0xf0, 0x88, 0x29, 0x58, 0x32, 0x8b, + 0x5d, 0x5f, 0x1b, 0x45, 0x3a, 0xaa, 0x39, 0x2c, 0x99, 0xc5, 0xe6, 0x32, 0x72, 0x05, 0x36, 0xfd, + 0x58, 0xec, 0x33, 0xe9, 0x4f, 0xdd, 0x80, 0xa5, 0x72, 0x8a, 0xc4, 0x54, 0x69, 0x27, 0x97, 0x7e, + 0xae, 0x84, 0x2b, 0xb0, 0x79, 0x18, 0xc8, 0x29, 0x12, 0xb3, 0x04, 0xfb, 0x56, 0x09, 0xd5, 0xa5, + 0xc2, 0x8b, 0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fa, 0xb8, 0xb7, 0x01, 0xe7, 0x7d, 0x1e, 0x0f, 0xd3, 0x30, 0x99, 0xf8, 0x5e, 0x3a, 0x94, 0x61, + 0x30, 0xc2, 0xa0, 0x1f, 0x5b, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x64, 0x2b, 0x13, 0x58, 0x34, + 0x0c, 0x00, 0x00, } func (m *AnalyzeReq) Marshal() (dAtA []byte, err error) { @@ -1817,6 +1891,39 @@ func (m *FMSketch) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *HllSketch) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *HllSketch) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HllSketch) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Registers) > 0 { + for iNdEx := len(m.Registers) - 1; iNdEx >= 0; iNdEx-- { + i = encodeVarintAnalyze(dAtA, i, uint64(m.Registers[iNdEx])) + i-- + dAtA[i] = 0x10 + } + } + i = encodeVarintAnalyze(dAtA, i, uint64(m.BucketBits)) + i-- + dAtA[i] = 0x8 + return len(dAtA) - i, nil +} + func (m *SampleCollector) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1837,6 +1944,18 @@ func (m *SampleCollector) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.HllSketch != nil { + { + size, err := m.HllSketch.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAnalyze(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } if m.TotalSize != nil { i = encodeVarintAnalyze(dAtA, i, uint64(*m.TotalSize)) i-- @@ -1904,6 +2023,20 @@ func (m *RowSampleCollector) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.HllSketch) > 0 { + for iNdEx := len(m.HllSketch) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.HllSketch[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintAnalyze(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } if len(m.TotalSize) > 0 { for iNdEx := len(m.TotalSize) - 1; iNdEx >= 0; iNdEx-- { i = encodeVarintAnalyze(dAtA, i, uint64(m.TotalSize[iNdEx])) @@ -2342,6 +2475,21 @@ func (m *FMSketch) Size() (n int) { return n } +func (m *HllSketch) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovAnalyze(uint64(m.BucketBits)) + if len(m.Registers) > 0 { + for _, e := range m.Registers { + n += 1 + sovAnalyze(uint64(e)) + } + } + return n +} + func (m *SampleCollector) Size() (n int) { if m == nil { return 0 @@ -2367,6 +2515,10 @@ func (m *SampleCollector) Size() (n int) { if m.TotalSize != nil { n += 1 + sovAnalyze(uint64(*m.TotalSize)) } + if m.HllSketch != nil { + l = m.HllSketch.Size() + n += 1 + l + sovAnalyze(uint64(l)) + } return n } @@ -2399,6 +2551,12 @@ func (m *RowSampleCollector) Size() (n int) { n += 1 + sovAnalyze(uint64(e)) } } + if len(m.HllSketch) > 0 { + for _, e := range m.HllSketch { + l = e.Size() + n += 1 + l + sovAnalyze(uint64(l)) + } + } return n } @@ -4340,6 +4498,151 @@ func (m *FMSketch) Unmarshal(dAtA []byte) error { } return nil } +func (m *HllSketch) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnalyze + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HllSketch: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HllSketch: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BucketBits", wireType) + } + m.BucketBits = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnalyze + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BucketBits |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType == 0 { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnalyze + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Registers = append(m.Registers, 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 < 0 { + return ErrInvalidLengthAnalyze + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + var elementCount int + var count int + for _, integer := range dAtA[iNdEx:postIndex] { + if integer < 128 { + count++ + } + } + elementCount = count + if elementCount != 0 && len(m.Registers) == 0 { + m.Registers = make([]uint32, 0, elementCount) + } + for iNdEx < postIndex { + var v uint32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnalyze + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Registers = append(m.Registers, v) + } + } else { + return fmt.Errorf("proto: wrong wireType = %d for field Registers", wireType) + } + default: + iNdEx = preIndex + skippy, err := skipAnalyze(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthAnalyze + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *SampleCollector) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -4531,6 +4834,42 @@ func (m *SampleCollector) Unmarshal(dAtA []byte) error { } } m.TotalSize = &v + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HllSketch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnalyze + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAnalyze + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAnalyze + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.HllSketch == nil { + m.HllSketch = &HllSketch{} + } + if err := m.HllSketch.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAnalyze(dAtA[iNdEx:]) @@ -4820,6 +5159,40 @@ func (m *RowSampleCollector) Unmarshal(dAtA []byte) error { } else { return fmt.Errorf("proto: wrong wireType = %d for field TotalSize", wireType) } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field HllSketch", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowAnalyze + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthAnalyze + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthAnalyze + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.HllSketch = append(m.HllSketch, &HllSketch{}) + if err := m.HllSketch[len(m.HllSketch)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipAnalyze(dAtA[iNdEx:]) diff --git a/proto/analyze.proto b/proto/analyze.proto index b1d509d7..de8b249f 100644 --- a/proto/analyze.proto +++ b/proto/analyze.proto @@ -137,6 +137,12 @@ message FMSketch { repeated uint64 hashset = 2; } +// HllSketch is used to estimate NDV with HyperLogLog. +message HllSketch { + optional uint32 bucket_bits = 1 [(gogoproto.nullable) = false]; + repeated uint32 registers = 2; +} + // SampleCollector is used for collect samples and calculate the count and ndv of an column. message SampleCollector { repeated bytes samples = 1; @@ -145,6 +151,7 @@ message SampleCollector { optional FMSketch fm_sketch = 4; optional CMSketch cm_sketch = 5; optional int64 total_size = 6; + optional HllSketch hll_sketch = 7; } message RowSampleCollector { @@ -153,6 +160,7 @@ message RowSampleCollector { optional int64 count = 3 [(gogoproto.nullable) = false]; repeated FMSketch fm_sketch = 4; repeated int64 total_size = 5; + repeated HllSketch hll_sketch = 6; } message RowSample {