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

Function as_single_row_range

crates/paimon/src/arrow/format/vortex.rs:210–225  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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).
210fn 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

Callers 1

read_batch_streamMethod · 0.85

Calls 4

toMethod · 0.80
is_emptyMethod · 0.45
lenMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected