MCPcopy Create free account
hub / github.com/apache/paimon-rust / intersect_sorted_ranges

Function intersect_sorted_ranges

crates/paimon/src/table/data_file_reader.rs:367–383  ·  view source on GitHub ↗

Intersect two sorted lists of inclusive RowRanges using a merge-style scan.

(a: &[RowRange], b: &[RowRange])

Source from the content-addressed store, hash-verified

365
366/// Intersect two sorted lists of inclusive RowRanges using a merge-style scan.
367fn intersect_sorted_ranges(a: &[RowRange], b: &[RowRange]) -> Vec<RowRange> {
368 let mut result = Vec::new();
369 let (mut i, mut j) = (0, 0);
370 while i < a.len() && j < b.len() {
371 let from = a[i].from().max(b[j].from());
372 let to = a[i].to().min(b[j].to());
373 if from <= to {
374 result.push(RowRange::new(from, to));
375 }
376 if a[i].to() < b[j].to() {
377 i += 1;
378 } else {
379 j += 1;
380 }
381 }
382 result
383}
384
385/// Expand row_ranges into a flat sequence of selected row IDs for a file.
386/// Intended for per-batch _ROW_ID attachment — callers should not pass

Callers 1

merge_row_selectionFunction · 0.70

Calls 3

toMethod · 0.80
lenMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected