Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# sketches-java

This repo contains Java implementations of the distributed quantile sketch algorithms `DDSketch` [1] and `GKArray` [2]. Both sketches are mergeable, meaning that multiple sketches from distributed systems can be combined in a central node.
This repo contains Java implementations of the distributed quantile sketch algorithm `DDSketch` [1]. DDSketch is mergeable, meaning that multiple sketches from distributed systems can be combined in a central node.

# Quick start guide

Expand Down Expand Up @@ -40,12 +40,5 @@ The size of the sketch can be upper-bounded by using collapsing stores. For inst

The memory size of the sketch depends on the range that is covered by the input values: the larger that range, the more bins are needed to keep track of the input values. As a rough estimate, if working on durations using `DDSketches.unboundedDense(0.02)` (relative accuracy of 2%), about 2kB (275 bins) are needed to cover values between 1 millisecond and 1 minute, and about 6kB (802 bins) to cover values between 1 nanosecond and 1 day. The number of bins that are maintained can be upper-bounded using collapsing stores (see for example `DDSketches.collapsingLowestDense()` and `DDSketches.collapsingHighestDense()`).

# GKArray

GKArray is a sketch with rank error guarantees. Refer to [2] for more details.

# References
[1] Charles Masson, Jee E. Rim and Homin K. Lee. DDSketch: A Fast and Fully-Mergeable Quantile Sketch with Relative-Error Guarantees. 2019.

[2] Michael B. Greenwald and Sanjeev Khanna. Space-efficient online computation of quantile summaries. In Proc. 2001 ACM
SIGMOD International Conference on Management of Data, SIGMOD ’01, pages 58–66. ACM, 2001.
9 changes: 6 additions & 3 deletions src/main/java/com/datadoghq/sketch/QuantileSketch.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ public interface QuantileSketch<QS extends QuantileSketch<QS>> extends DoubleCon
void accept(double value);

/**
* Adds a value to the sketch as many times as specified by {@code count}.
* Adds a value to the sketch with a floating-point {@code count}.
*
* <p>If {@code count} is an integer, calling {@code accept(value, count)} is equivalent to calling
* {@code accept(value)} {@code count} times.
*
* @param value the value to be added
* @param count the number of times the value is to be added
* @param count the weight associated with the value to be added
* @throws IllegalArgumentException if {@code count} is negative
*/
void accept(double value, long count);
void accept(double value, double count);

/**
* Merges the other sketch into this one. After this operation, this sketch encodes the values that were added to
Expand Down
11 changes: 0 additions & 11 deletions src/main/java/com/datadoghq/sketch/ddsketch/DDSketch.java
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,6 @@ public void accept(double value) {
* @throws IllegalArgumentException if the value is outside the range that is tracked by the sketch
*/
@Override
public void accept(double value, long count) {
accept(value, (double) count);
}

/**
* Adds a value to the sketch with a floating-point {@code count}.
*
* @param value the value to be added
* @param count the weight associated with the value to be added
* @throws IllegalArgumentException if {@code count} is negative
*/
public void accept(double value, double count) {

checkValueTrackable(value);
Expand Down
301 changes: 0 additions & 301 deletions src/main/java/com/datadoghq/sketch/gk/GKArray.java

This file was deleted.

Loading