You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Summary:
This issue proposes adding an implementation of DDSketch, a mergeable quantile sketch with relative-error guarantees, to the datasketches-cpp library.
Thank you for the responses and the helpful references to prior discussions @AlexanderSaydakov — this has been very informative.
I’m still interested in exploring a DDSketch implementation, even if just as an experimental project.
Based on the discussion you mentioned, I’ll reflect deeply on whether (and how) it might be possible to make somewhat fair comparisons between sketches with different goals and guarantees.
Please let me know if there could still be interest in this kind of work, or if there’s openness to reopening the discussion at some point down the line.
Of course, any new sketches are welcome if they have solid research behind them and have substantially different trade-offs compared to ones already implemented in the library. As I understand, closest competitors to DDSketch are REQ sketch and t-digest. Do you think that DDSketch can be a better choice for some applications?
I believe it offers accuracy guarantees that t-digest cannot, while providing dual-tailed relative error. It’s numeric so it can do things REQ can’t (two-sided) and is likely smaller, too.
I think it’s a reasonable sketch to include. But we’d want to ensure the API uses similar naming as our existing sketches.
I’ve been working on the characterization of DDSketch and comparing it against t-digest and REQ sketch. After digging into the literature and implementations, one compelling reason to consider adding DDSketch to the library is that it provides accuracy guarantees that the others do not. Specifically, DDSketch guarantees bounded relative error in value space. In contrast, REQ sketch provides guarantees in relative rank error, and t-digest has no formal worst-case bounds.
The figure below shows the relative quantile error as a function of stream size for the three sketches:
Since REQ sketch seems to outperform DDSketch for sufficiently large streams, I'd like to compare their memory footprints as well, to get a full picture. The memory profiling job takes a while to run (hours or maybe days), even after the optimization I did. Does anyone have the data used to produce the memory plots? They don't seem to be in the datasketches-characterization repo.
My criticism off this plot is that the input data is an exponential series, which is the ideal case for the DDSketch because its bins form an exponential series in size. The TDigest, REQ and KLL sketches are much more distribution insensitive. Try some different input distributions.
Also you measurement of error is |true - estimate| / estimate, which is incorrect. It should be (estimate - true) / true. For example: if true = 100 and est = 50, your calculation yields 100%, while the correct calculation is 50% error. Also, It is better to use parenthesis instead of absolute values, as it will inform negative error (underestimates) vs positive error (over estimates).
I am going to close this Issue. The associated PR #466 hasn't had any action for a while and has a number of issues that were never resolved. This can always be reopened.
Activity
[-]## Proposal: Add DDSketch (Relative-Error Quantile Sketch)[/-][+]Proposal: Add DDSketch (Relative-Error Quantile Sketch)[/+]AlexanderSaydakov commentedon May 29, 2025
REQ sketch offers relative error guarantee.
AlexanderSaydakov commentedon May 29, 2025
t-digest also prioritizes high and low rank accuracy
see #416
AlexanderSaydakov commentedon May 29, 2025
I also found this discussion some years ago:
apache/datasketches-java#357
geonove commentedon May 29, 2025
Thank you for the responses and the helpful references to prior discussions @AlexanderSaydakov — this has been very informative.
I’m still interested in exploring a DDSketch implementation, even if just as an experimental project.
Based on the discussion you mentioned, I’ll reflect deeply on whether (and how) it might be possible to make somewhat fair comparisons between sketches with different goals and guarantees.
Please let me know if there could still be interest in this kind of work, or if there’s openness to reopening the discussion at some point down the line.
AlexanderSaydakov commentedon May 29, 2025
Of course, any new sketches are welcome if they have solid research behind them and have substantially different trade-offs compared to ones already implemented in the library. As I understand, closest competitors to DDSketch are REQ sketch and t-digest. Do you think that DDSketch can be a better choice for some applications?
jmalkin commentedon May 30, 2025
I believe it offers accuracy guarantees that t-digest cannot, while providing dual-tailed relative error. It’s numeric so it can do things REQ can’t (two-sided) and is likely smaller, too.
I think it’s a reasonable sketch to include. But we’d want to ensure the API uses similar naming as our existing sketches.
geonove commentedon Jan 15, 2026
I’ve been working on the characterization of
DDSketchand comparing it againstt-digestandREQ sketch. After digging into the literature and implementations, one compelling reason to consider addingDDSketchto the library is that it provides accuracy guarantees that the others do not. Specifically,DDSketchguarantees boundedrelative error in value space. In contrast,REQ sketchprovides guarantees inrelative rank error, andt-digesthas no formal worst-case bounds.The figure below shows the
relative quantile erroras a function ofstream sizefor the three sketches:Since
REQ sketchseems to outperformDDSketchfor sufficiently large streams, I'd like to compare their memory footprints as well, to get a full picture. The memory profiling job takes a while to run (hours or maybe days), even after the optimization I did. Does anyone have the data used to produce the memory plots? They don't seem to be in thedatasketches-characterizationrepo.leerho commentedon Mar 23, 2026
My criticism off this plot is that the input data is an exponential series, which is the ideal case for the DDSketch because its bins form an exponential series in size. The TDigest, REQ and KLL sketches are much more distribution insensitive. Try some different input distributions.
Also you measurement of error is |true - estimate| / estimate, which is incorrect. It should be (estimate - true) / true. For example: if true = 100 and est = 50, your calculation yields 100%, while the correct calculation is 50% error. Also, It is better to use parenthesis instead of absolute values, as it will inform negative error (underestimates) vs positive error (over estimates).
leerho commentedon Oct 1, 2026
I am going to close this Issue. The associated PR #466 hasn't had any action for a while and has a number of issues that were never resolved. This can always be reopened.