Skip to content

Add a unit test to reproduce count threshold bucket behavior - #88

Draft
vmingchen wants to merge 1 commit into
masterfrom
ming.chen/sketchcnt
Draft

Add a unit test to reproduce count threshold bucket behavior#88
vmingchen wants to merge 1 commit into
masterfrom
ming.chen/sketchcnt

Conversation

@vmingchen

@vmingchen vmingchen commented Dec 5, 2025

Copy link
Copy Markdown

What does this PR do?

Add TestCountThresholdSameBucket_ZD2354669 to verify DDSketch's approximate count behavior when querying for threshold values.

The test demonstrates that:

  • When value 1033 is inserted into the sketch, it maps to a bucket with range approximately [1030.34, 1046.56)
  • Querying count for any value in [1031-1046] returns countEq=1 because all these values map to the same bucket
  • Querying count for 1030 and 1047 returns countEq=0 because they map to different buckets

This confirms that DDSketch provides approximate counts with ~1.56% relative accuracy, not exact counts for specific values.

Motivation

Explain a user support ticket.

Additional Notes

See more details about DDSketch in the VLDB paper.

Add TestCountThresholdSameBucket_ZD2354669 to verify DDSketch's approximate
count behavior when querying for threshold values.

The test demonstrates that:
- When value 1033 is inserted into the sketch, it maps to a bucket with
  range approximately [1030.34, 1046.56)
- Querying count for any value in [1031-1046] returns countEq=1 because
  all these values map to the same bucket
- Querying count for 1030 and 1047 returns countEq=0 because they map
  to different buckets

This confirms that DDSketch provides approximate counts with ~1.56%
relative accuracy, not exact counts for specific values.

See more details about DDSketch in [the VLDB paper](http://arxiv.org/pdf/1908.10693).
@vmingchen vmingchen changed the title Add comprehensive test for DDSketch count threshold bucket behavior Add a unit test to reproduce count threshold bucket behavior Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant