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

vortex-data / vortex / 16970635821

14 Aug 2025 04:13PM UTC coverage: 85.882% (-1.8%) from 87.693%
16970635821

Pull #4215

github

web-flow
Merge 5182504a6 into f547cbca5
Pull Request #4215: Ji/vectors

80 of 1729 new or added lines in 38 files covered. (4.63%)

117 existing lines in 25 files now uncovered.

56994 of 66363 relevant lines covered (85.88%)

609331.7 hits per line

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

0.0
/vortex-array/src/pipeline/bits/iter.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use arrow_buffer::BooleanBuffer;
5
use arrow_buffer::bit_chunk_iterator::BitChunkIterator;
6
use bitvec::order::Msb0;
7
use bitvec::slice::{BitSlice, ChunksExact};
8

9
use crate::pipeline::N;
10

NEW
11
pub fn iter_boolean_buffer<'a>(buffer: &'a BooleanBuffer) -> ChunksExact<'a, u64, Msb0> {
×
NEW
12
    assert_eq!(buffer.offset(), 0, "BooleanBuffer must have an offset of 0");
×
NEW
13
    let ptr = buffer.inner().as_ptr().cast::<u64>();
×
NEW
14
    assert!(ptr.is_aligned(), "BooleanBuffer must be aligned to 64 bits");
×
NEW
15
    let data = unsafe { std::slice::from_raw_parts(ptr, buffer.len()) };
×
NEW
16
    let slice = BitSlice::<u64, Msb0>::from_slice(data);
×
NEW
17
    slice.chunks_exact(N)
×
NEW
18
}
×
19

20
pub struct BooleanBufferChunksIter<'a> {
21
    bit_chunks: BitChunkIterator<'a>,
22
    remainder_bits: Option<u64>,
23
    finished: bool,
24
}
25

26
impl<'a> BooleanBufferChunksIter<'a> {
NEW
27
    pub fn new(buffer: &'a BooleanBuffer) -> Self {
×
NEW
28
        let bit_chunks = buffer.bit_chunks();
×
NEW
29
        let remainder_bits = bit_chunks.remainder_bits();
×
NEW
30
        BooleanBufferChunksIter {
×
NEW
31
            bit_chunks: bit_chunks.into_iter(),
×
NEW
32
            remainder_bits: Some(remainder_bits),
×
NEW
33
            finished: false,
×
NEW
34
        }
×
NEW
35
    }
×
36
}
37

38
impl Iterator for BooleanBufferChunksIter<'_> {
39
    type Item = [u64; N / 64];
40

NEW
41
    fn next(&mut self) -> Option<Self::Item> {
×
NEW
42
        if self.finished && self.remainder_bits.is_none() {
×
NEW
43
            return None;
×
NEW
44
        }
×
45

46
        // Number of words in a BitVector.
47
        const W: usize = N / 64;
NEW
48
        let mut chunk = [0u64; W];
×
49

50
        // We copy bit-chunks into our bitvector, until we reach the end of the chunks.
NEW
51
        let mut words = 0;
×
NEW
52
        while words < W {
×
NEW
53
            match self.bit_chunks.next() {
×
54
                None => {
NEW
55
                    self.finished = true;
×
NEW
56
                    break;
×
57
                }
NEW
58
                Some(word) => {
×
NEW
59
                    chunk[words] = word;
×
NEW
60
                    words += 1;
×
NEW
61
                }
×
62
            }
63
        }
64

NEW
65
        if words < W
×
NEW
66
            && let Some(remainder_bits) = self.remainder_bits.take()
×
NEW
67
        {
×
NEW
68
            chunk[words] = remainder_bits;
×
NEW
69
        }
×
70

NEW
71
        Some(chunk)
×
NEW
72
    }
×
73
}
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