Documentation ¶
Index ¶
- Constants
- type HLL
- func (s *HLL) Add(hash uint64)
- func (s *HLL) Clone() *HLL
- func (s *HLL) Downgrade(precision, sparsePrecision uint8) error
- func (s *HLL) Estimate() int64
- func (s *HLL) Merge(other *HLL)
- func (s *HLL) Precision() uint8
- func (s *HLL) Proto() *pb.HyperLogLogPlusUniqueStateProto
- func (s *HLL) SparsePrecision() uint8
Constants ¶
const ( MinPrecision = 10 MaxPrecision = 24 MaxSparsePrecision = 25 )
Precision bounds.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HLL ¶
type HLL struct {
// contains filtered or unexported fields
}
HLL is a HyperLogLog++ sketch implementation.
func New ¶
New inits a new sketch. The normal precision must be between 10 and 24. The sparse precision must be between 0 and 25. This function only returns an error when an invalid precision is provided.
func NewFromProto ¶
func NewFromProto(msg *pb.HyperLogLogPlusUniqueStateProto) (*HLL, error)
NewFromProto inits/restores a sketch from proto message.
func (*HLL) Downgrade ¶
Downgrade tries to reduce the precision of the sketch. Attempts to increase precision will be ignored.
func (*HLL) Estimate ¶
Estimate computes the cardinality estimate according to the algorithm in Figure 6 of the HLL++ paper (https://goo.gl/pc916Z).
func (*HLL) Proto ¶
func (s *HLL) Proto() *pb.HyperLogLogPlusUniqueStateProto
Proto builds a BigQuery-compatible protobuf message, representing HLL aggregator state.
func (*HLL) SparsePrecision ¶
SparsePrecision returns the sparse precision.