• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vortex-data / vortex / 16448798227

22 Jul 2025 03:30PM UTC coverage: 81.013% (-0.1%) from 81.109%
16448798227

Pull #3876

github

web-flow
Merge 5ae90ffd4 into db33b9fe9
Pull Request #3876: feat[layout]: replace register_splits with a layout splits stream

460 of 571 new or added lines in 17 files covered. (80.56%)

29 existing lines in 4 files now uncovered.

42262 of 52167 relevant lines covered (81.01%)

169362.77 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.35
/vortex-scan/src/selection_intersection.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use crate::Selection;
5
use crate::row_mask::RowMask;
6
use std::ops::{BitAnd, Range};
7
use vortex_error::{VortexExpect, VortexResult};
8
use vortex_layout::masks::BoxMaskIterator;
9

10
/// Given an iterator of masks a range and a selection, returns row masks that intersect the range
11
/// and satisfy the selection
12
pub struct SelectionIntersectionMaskIterator {
13
    iterators: BoxMaskIterator,
14
    offset: u64,
15
    selection: Selection,
16
    range: Range<u64>,
17
}
18

19
impl SelectionIntersectionMaskIterator {
20
    pub fn new(iterators: BoxMaskIterator, selection: Selection) -> Self {
1,392✔
21
        Self {
1,392✔
22
            iterators,
1,392✔
23
            selection,
1,392✔
24
            offset: 0,
1,392✔
25
            range: 0..u64::MAX,
1,392✔
26
        }
1,392✔
27
    }
1,392✔
28

29
    pub fn with_range(&mut self, range: Range<u64>) {
352✔
30
        self.range = range;
352✔
31
    }
352✔
32
}
33

34
impl Iterator for SelectionIntersectionMaskIterator {
35
    type Item = VortexResult<RowMask>;
36

37
    fn next(&mut self) -> Option<Self::Item> {
3,584✔
38
        loop {
39
            let mask = match self.iterators.next() {
4,470✔
40
                None => return None,
1,392✔
NEW
41
                Some(Err(e)) => return Some(Err(e)),
×
42
                Some(Ok(mask)) => mask,
3,078✔
43
            };
44

45
            let mask_start = self.offset;
3,078✔
46
            let mask_end = self.offset + mask.len() as u64;
3,078✔
47
            self.offset = mask_end;
3,078✔
48

49
            // Check if mask is completely outside range
50
            if mask_end <= self.range.start || mask_start >= self.range.end {
3,078✔
51
                continue;
886✔
52
            }
2,192✔
53

54
            let overlap_start = mask_start.max(self.range.start);
2,192✔
55
            let overlap_end = mask_end.min(self.range.end);
2,192✔
56

57
            // If mask is partially outside range, slice it
58
            let (sliced_mask, slice_offset) =
2,192✔
59
                if overlap_start > mask_start || overlap_end < mask_end {
2,192✔
60
                    let local_start = (overlap_start - mask_start) as usize;
596✔
61
                    (
596✔
62
                        mask.slice(
596✔
63
                            local_start,
596✔
64
                            usize::try_from(overlap_end - overlap_start)
596✔
65
                                .vortex_expect("must will fit into usize"),
596✔
66
                        ),
596✔
67
                        overlap_start,
596✔
68
                    )
596✔
69
                } else {
70
                    (mask, mask_start)
1,596✔
71
                };
72

73
            // Fast path for all-false masks
74
            if sliced_mask.all_false() {
2,192✔
NEW
75
                return Some(Ok(RowMask::new(slice_offset, sliced_mask)));
×
76
            }
2,192✔
77

78
            // Apply selection mask to the effective range
79
            let selection_mask = self.selection.mask(slice_offset, sliced_mask.len());
2,192✔
80
            let final_mask = selection_mask.bitand(&sliced_mask);
2,192✔
81

82
            return Some(Ok(RowMask::new(slice_offset, final_mask)));
2,192✔
83
        }
84
    }
3,584✔
85
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc