Skip to content

fix(tdigest): preserve stored min and max when merging - #280

Closed
jaideeppyne wants to merge 1 commit into
apache:mainfrom
jaideeppyne:fix/tdigest-merge-minmax
Closed

jaideeppyne wants to merge 1 commit into
apache:mainfrom
jaideeppyne:fix/tdigest-merge-minmax

Conversation

@jaideeppyne

Copy link
Copy Markdown
Contributor

Fixes #277.

Summary

  • Copy the stored min / max from the other digest in TDigestMut::merge before compressing the combined centroid list.
  • Add a regression that merges a deserialized image whose extreme centroids have weight > 1 (so their means are not the true extrema).
  • Document the bug fix in the changelog.

Why

Compression never merges the extreme centroids for digests built through update, so this is invisible on that path. Reference-format and other deserialized images can store min/max strictly outside the extreme centroid means. merge previously ignored those fields and re-derived extrema from centroid means, so:

  • min_value() / max_value() drifted inward
  • rank / quantile tail interpolation used the wrong endpoints

This is the same class of tail-interpolation defect as #250, on the merge path rather than the query formulas.

Validation

  • cargo test -p tests-integration --test tdigest_test
  • cargo +nightly clippy -p datasketches --all-features -- -D warnings

Merging a digest whose extreme centroids have weight greater than one
re-derived min and max from those centroid means. Copy the stored extrema
from the other digest first so rank and quantile tail interpolation stay
correct, especially for deserialized reference-format images.

Fixes apache#277.
@jaideeppyne

Copy link
Copy Markdown
Contributor Author

Closing as duplicate of #279 (same #277 fix).

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.

T-Digest: merge() silently corrupts min/max

1 participant