apache / apache/datasketches-java

Question: How do we ensure `TDigest::merge` never causes numCentroids over centroidsCapacity and thus index out of bound?

Closed
#703 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
958
Forks
226
Avg merge
3d 9h
Merged PRs (30d)
8

Description

https://github.com/apache/datasketches-java/blob/37edd8c9898f8f073aaafad7097cb0949eb84c85/src/main/java/org/apache/datasketches/tdigest/TDigestDouble.java#L571-L602

I don't find any constraint that `numCentroids` will never exceed `centroidsCapacity` here.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading TDigestDouble.java lines 571-602 and trace how merge updates numCentroids and uses centroidsCapacity. Determine whether the code establishes the required bound; done means documenting the invariant or identifying the precise change needed if it does not.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.