Documentation ¶
Overview ¶
Package zetasketch provices a collection of libraries for single-pass, distributed, sublinear-space approximate aggregation and sketching algorithms.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Aggregator ¶
type Aggregator interface { // Add adds a value. Add(v Value) // NumValues returns the total number of input values that this aggregator has seen. NumValues() int64 // Merge merges two aggregators. Merge(other Aggregator) error encoding.BinaryMarshaler encoding.BinaryUnmarshaler }
Aggregator provides an interface that wraps distributed, online aggregation algorithm.
type HLL ¶
type HLL struct {
// contains filtered or unexported fields
}
HLL implements a HLL++ aggregator for estimating cardinalities of multisets.
The precision defines the accuracy of the HLL++ aggregator at the cost of the memory used. The upper bound on the memory required is 2^precision bytes, but less memory is used for smaller cardinalities. The relative error is 1.04 / sqrt(2^precision). A typical value used at Google is 15, which gives an error of about 0.6% while requiring an upper bound of 32KiB of memory.
Note that this aggregator is not designed to be thread safe.
func (*HLL) MarshalBinary ¶
MarshalBinary serializes aggregator to bytes.
func (*HLL) Merge ¶
func (h *HLL) Merge(other Aggregator) error
Merge merges aggregator other into h.
func (*HLL) UnmarshalBinary ¶
UnmarshalBinary deserializes aggregator from bytes.
type HLLConfig ¶
type HLLConfig struct { // Defaults to 15. Precision uint8 // If no sparse precision is specified, the default is calculated as precision + 5. SparsePrecision uint8 }
HLLConfig speficies the configuration parameters for the HLL++ aggregator.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
hash
Package hash implements hashing as done in zetasketch Java library https://github.com/google/zetasketch/blob/master/java/com/google/zetasketch/internal/hash/.
|
Package hash implements hashing as done in zetasketch Java library https://github.com/google/zetasketch/blob/master/java/com/google/zetasketch/internal/hash/. |