fix(data): remove MinMaxPyramid::reduce, repoint its two test callers

The pyramid's public query surface is the bucket-grained trio
(reduce_buckets/sum_buckets/sumsq_buckets); reduce() was the one
non-*_buckets query and silently over-covered non-aligned ranges, which
is exactly the misuse the exactness split exists to prevent. Exact range
queries stay on Series.

- delete the declaration, its doc paragraph and the definition; no
  helper became dead (fold_range/cover_buckets/ceil_to_bucket are all
  still used by the *_buckets queries)
- pyramid_clear_and_rebuild: complete bucket 0 and assert its extrema via
  reduce_buckets(0, kBucket) -- a pyramid has no exact sub-bucket query
- stream_series_acquire_publishes_snapshot: s.pyramid().reduce(0, 100)
  -> s.reduce(0, 100), keeping the == 99.0 assertion
This commit is contained in:
Martino Ferrari committed 2026-09-27 21:45:03 +02:00
1 parent d9909f2115
commit 5f1a4991e2
4 files changed
+8 -19

No files matched your search

-8
View File
@@ -28,9 +28,6 @@ inline constexpr u32 kBucket = 64;
/// buckets; a range with partial edge buckets would silently pull in samples
/// outside the range. Every query here is therefore bucket-grained and named
/// *_buckets, and exact range queries live on Series, which owns the raw samples.
/// reduce() is the one non-*_buckets query: it is the *covering* aggregate over
/// the level-0 buckets that [begin, end) touches. Use it to ask which buckets a
/// range spans, never to measure a range.
class MinMaxPyramid {
public:
MinMaxPyramid() { add_level(); }
@@ -55,11 +52,6 @@ class MinMaxPyramid {
f64 sum_buckets(u64 begin, u64 end) const;
/// Sum of squares of the samples in those same whole buckets.
f64 sumsq_buckets(u64 begin, u64 end) const;
/// Min/max over the covering level-0 buckets: every bucket that holds a sample
/// of [begin, end). Exact only when the range is bucket-aligned.
Range reduce(u64 begin, u64 end) const;
/// Pyramid level whose buckets hold about `samples_per_pixel` samples, for a
/// window of `n` samples: 0 when a pixel covers at most one bucket. Clamped to
/// the levels that exist, to levels with more than one bucket, and to levels