If the ranges represent a single contiguous range, return it as a `Range ` for use with `ScanBuilder::with_row_range` (more efficient than a roaring bitmap).
(ranges: &[RowRange], total_rows: u64)
| 208 | /// If the ranges represent a single contiguous range, return it as a `Range<u64>` |
| 209 | /// for use with `ScanBuilder::with_row_range` (more efficient than a roaring bitmap). |
| 210 | fn as_single_row_range(ranges: &[RowRange], total_rows: u64) -> Option<std::ops::Range<u64>> { |
| 211 | if ranges.is_empty() || total_rows == 0 { |
| 212 | return None; |
| 213 | } |
| 214 | let file_end = total_rows as i64 - 1; |
| 215 | if ranges.len() == 1 { |
| 216 | let r = &ranges[0]; |
| 217 | if r.to() < 0 || r.from() > file_end { |
| 218 | return None; |
| 219 | } |
| 220 | let from = r.from().max(0) as u64; |
| 221 | let to = (r.to().min(file_end) as u64) + 1; |
| 222 | return Some(from..to); |
| 223 | } |
| 224 | None |
| 225 | } |
| 226 | |
| 227 | // --------------------------------------------------------------------------- |
| 228 | // Predicate → Vortex Expression conversion |
no test coverage detected