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

-9
View File
@@ -221,15 +221,6 @@ f64 MinMaxPyramid::sumsq_buckets(u64 begin, u64 end) const {
return total;
}
Range MinMaxPyramid::reduce(u64 begin, u64 end) const {
const u64 e = std::min(end, size_);
const u64 b = std::min(begin, e);
if (e <= b) return Range{0.0, 0.0};
const u64 b0 = b / kBucket; // first bucket holding a sample
const u64 b1 = (e - 1) / kBucket + 1; // one past the last one
return fold_range(*this, b0, b1);
}
u32 MinMaxPyramid::level_for(u64 n, f64 samples_per_pixel) const {
// The ratio test also rejects NaN, and the clamp keeps a huge (or infinite)
// samples-per-pixel from making the floor-to-u32 conversion ill-formed.