(&mut self)
| 88 | } |
| 89 | |
| 90 | fn ensure_sorted(&mut self) { |
| 91 | if !self.sorted { |
| 92 | // Radix-style: group by partition first (few distinct values), |
| 93 | // then sort within groups by timestamp. This is faster than a |
| 94 | // full comparison sort when partition_start has low cardinality. |
| 95 | self.rows.sort_unstable_by(|a, b| { |
| 96 | a.target_partition_start |
| 97 | .cmp(&b.target_partition_start) |
| 98 | .then(a.timestamp_ms.cmp(&b.timestamp_ms)) |
| 99 | .then(a.series_id.cmp(&b.series_id)) |
| 100 | }); |
| 101 | self.sorted = true; |
| 102 | } |
| 103 | } |
| 104 | |
| 105 | pub fn len(&self) -> usize { |
| 106 | self.rows.len() |
no test coverage detected