uddsketch

package
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Invalid byte = iota
	Negative
	Zero
	Positive
)

Constants for SketchHashKey types

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketEntry

type BucketEntry struct {
	Key   SketchHashKey `json:"key"`
	Count uint64        `json:"count"`
}

BucketEntry represents a bucket in the sketch

type CompressedBuckets

type CompressedBuckets struct {
	// contains filtered or unexported fields
}

CompressedBuckets holds the compressed representation of sketch buckets

type PgUddSketch

type PgUddSketch struct {
	// contains filtered or unexported fields
}

PgUddSketch represents the PostgreSQL-compatible UDDSketch structure

type ReadableUddSketch

type ReadableUddSketch struct {
	Version     uint8         `json:"version"`
	Alpha       float64       `json:"alpha"`
	MaxBuckets  uint32        `json:"max_buckets"`
	NumBuckets  uint32        `json:"num_buckets"`
	Compactions uint64        `json:"compactions"`
	Count       uint64        `json:"count"`
	Sum         float64       `json:"sum"`
	Buckets     []BucketEntry `json:"buckets"`
}

ReadableUddSketch represents a human-readable format of the UDDSketch

type SketchHashEntry

type SketchHashEntry struct {
	// contains filtered or unexported fields
}

SketchHashEntry represents an entry in the SketchHashMap

type SketchHashKey

type SketchHashKey struct {
	// contains filtered or unexported fields
}

SketchHashKey represents the bucket index in the UDDSketch

type SketchHashMap

type SketchHashMap struct {
	// contains filtered or unexported fields
}

SketchHashMap is a specialized hash map that maintains ordered buckets

type UDDSketch

type UDDSketch struct {
	// contains filtered or unexported fields
}

UDDSketch implements the UDDSketch algorithm

func NewUDDSketch

func NewUDDSketch(maxBuckets uint64, initialError float64) (*UDDSketch, error)

NewUDDSketch creates a new UDDSketch with specified parameters

func (*UDDSketch) AddValue

func (s *UDDSketch) AddValue(value float64)

AddValue adds a value to the sketch

func (*UDDSketch) Count

func (s *UDDSketch) Count() uint64

func (*UDDSketch) EstimateQuantile

func (s *UDDSketch) EstimateQuantile(quantile float64) float64

EstimateQuantile returns the estimated value at the given quantile

func (*UDDSketch) EstimateQuantileAtValue

func (s *UDDSketch) EstimateQuantileAtValue(value float64) float64

EstimateQuantileAtValue estimates what quantile a value would be in the current sketch

func (*UDDSketch) Max

func (s *UDDSketch) Max() float64

func (*UDDSketch) MaxError

func (s *UDDSketch) MaxError() float64

func (*UDDSketch) Mean

func (s *UDDSketch) Mean() float64

func (*UDDSketch) MergeSketch

func (s *UDDSketch) MergeSketch(other *UDDSketch)

MergeSketch merges another sketch into this one

func (*UDDSketch) Min

func (s *UDDSketch) Min() float64

func (*UDDSketch) Sum

func (s *UDDSketch) Sum() float64

func (*UDDSketch) ToRON

func (s *UDDSketch) ToRON() string

func (*UDDSketch) ToReadable

func (s *UDDSketch) ToReadable() *ReadableUddSketch

func (*UDDSketch) ZeroCount

func (s *UDDSketch) ZeroCount() uint64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL