Expands an iterator of `(datum, diff)` into one `datum` per unit of `diff`. A non-positive `diff` contributes no copies. This is used by aggregates that are sensitive to multiplicity (e.g. `sum`), to recover a flat datum stream from the count-aware surface.
(datums: I)
| 2012 | /// are sensitive to multiplicity (e.g. `sum`), to recover a flat datum stream |
| 2013 | /// from the count-aware surface. |
| 2014 | fn expand_counts<'a, I>(datums: I) -> impl Iterator<Item = Datum<'a>> |
| 2015 | where |
| 2016 | I: IntoIterator<Item = (Datum<'a>, Diff)>, |
| 2017 | { |
| 2018 | datums.into_iter().flat_map(|(datum, diff)| { |
| 2019 | let copies = usize::try_from(diff.into_inner()).unwrap_or(0); |
| 2020 | std::iter::repeat(datum).take(copies) |
| 2021 | }) |
| 2022 | } |
| 2023 | |
| 2024 | impl AggregateFunc { |
| 2025 | /// Whether this aggregate's result is independent of the multiplicity of its |
no test coverage detected