-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
Summary
Add Go version ArrayOfDouble Tuple Sketch.
Design
ArrayOfDouble Tuple Sketch
// Number constraint for types that can be used in ArrayOfNumberSummary.
// NOTE: Only allowed fixed-size type.
type Number interface {
~int8 | ~int16 | ~int32 | ~int64 |
~uint8 | ~uint16 | ~uint32 | ~uint64 |
~float32 | ~float64
}
type ArrayOfNumberSketch[V Number] interface {
Sketch[*ArrayOfNumberSummary[V]]
// NumValuesInSummary returns the number of values in ArrayOfNumberSummary.
NumValuesInSummary() uint8
}
// ArrayOfNumberSummary is a fixed-size array of numeric values used as a summary in tuple sketches.
type ArrayOfNumberSummary[T Number] struct {
values []T
size uint8
}
// Reset clears the content of the summary, restoring it to its initial state.
func (s *ArrayOfNumberSummary[T]) Reset()
// Clone creates and returns a deep copy of the current Summary instance.
func (s *ArrayOfNumberSummary[T]) Clone() Summary
// Update incorporates a new value into the summary, modifying its internal state based on the given input value.
func (s *ArrayOfNumberSummary[T]) Update(values []T)
// Values returns the values in the summary.
func (s *ArrayOfNumberSummary[T]) Values() []TI’ve found that ArrayOfDouble sketch can be numeric array sketch. So i expand original one. Because of serialization, i decide to accept fixed size number type element array.
ArrayOfNumberSketchinherit and extendSketchto support numeric array summary sketch.ArrayOfNumberSummarywill do same thing ArrayOfDouble Sketch Summary. So will add givenvalueswhenUpdatemethod is called.
ArrayOfNumberUpdateSketch
// ArrayOfNumberUpdateSketch builds Tuple sketch from input data via update methods.
// This is a wrapper around a tuple sketch to match the functionality
// and serialization format of ArrayOfDoublesSketch in Java.
type ArrayOfNumberUpdateSketch[V Number] struct {
table *hashtable[*ArrayOfNumberSummary[V]]
numberOfValuesInSummary uint8
}ArrayOfNumberUpdateSketch implements ArrayOfNumberSketch
ArrayOfNumberCompactSketch
// ArrayOfNumberCompactSketch is the immutable, serializable form of an array of number tuple sketch.
type ArrayOfNumberCompactSketch[V Number] struct {
theta uint64
entries []entry[*ArrayOfNumberSummary[V]]
seedHash uint16
numberOfValuesInSummary uint8
isEmpty bool
isOrdered bool
}ArrayOfNumberCompactSketchimplementsArrayOfNumberSketch- serialization and deserialization follows encoder & decoder pattern.
Release Schedule
I will upload 3 PRs.
- A PR for
ArrayOfNumberUpdateSketchand interfaces. - A PR for
ArrayOfNumberCompactSketchand serialization / deserialization. - Set Operations.
Metadata
Metadata
Assignees
Labels
No labels