pub fn batch_windows(
buckets: &[PlannedBucket],
target_rows_per_query: i64,
) -> impl Iterator<Item = TimeRange>Expand description
Packs consecutive planned buckets into batch query windows, greedily closing a window just
before it would exceed target_rows_per_query.
A bucket whose own block count already exceeds target_rows_per_query still forms one batch on
its own – the loop never splits a bucket.
Batch edges are always bucket edges and batches tile from the first bucket’s start to the last
bucket’s end with no gaps or overlaps (the gaps between planned buckets hold no blocks), so
which width is picked cannot change the specs group_blocks_into_partitions later emits per
bucket – only how many SQL queries it takes to gather them. buckets must be ascending; an
empty buckets yields no window.