Countmin restructure - #30
Merged
Merged
Conversation
zzylol
added a commit
that referenced
this pull request
Jun 27, 2026
…t 1) asap-precompute-rs hardcoded sample_p=0.0 in all wrappers — it could decode a sampled envelope (query-side rescale) but never PRODUCE one, so a Rust edge under the CDM coordinator's ε-floor grant would ship unsampled full-rate sketches. Mirror Go's coordinated path (precompute.SampleSetter, applyGrantedSampleP): - New sampling.rs: GeometricSampler (NitroSketch geometric skip-sampling, splitmix64) + wire_sample_p (stamp 0.0 when exact for byte-parity, else p). - SampleSetter trait in precompute.rs — implemented by exactly CMS, CountSketch, DDSketch (the additive families). Sum/KLL/HLL deliberately excluded, matching Go's switch in applyGrantedSampleP (HLL keeps its own hash-threshold path). - Each of the 3 wrappers: sample_p field + GeometricSampler, with_sample_p builder + set_sample_p (reseed), admit-gate in update(), stamp wire_sample_p in the envelope, reseed on reset(). Seeds mirror Go (cms ZMPC / cs 0x5a3e06d / dd DDSP). - Count sketches rescale by 1/p on query; DDSketch is scale-invariant (samples to shed work, no rescale) — both still stamp p. Exact path unchanged: sample_p stays 0.0 → #243 byte-parity preserved (all 57+11+27 tests green). New test asserts admit≈p fraction + envelope stamp + SetSampleP. Part 2 (runtime hook: derive p from the engine's granted ε-floor and install the window sample-hook, mirroring Go's applyGrantedSampleP wiring) is a follow-up. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
zzylol
added a commit
that referenced
this pull request
Jun 27, 2026
…antile (#30) Locks in the quantile case: sampled DDSketch admits ~p of updates (total_count ~p×) but its quantile shape survives (scale-invariant, no 1/p rescale), and the envelope stamps p while the exact path stamps 0.0 for byte-parity. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replacing the old static implementation with a modular API (common, sketch) from sketchlib-go
https://github.com/approx-telemetry/sketchlib-go