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

vortex-data / vortex / 16979224669

14 Aug 2025 11:42PM UTC coverage: 23.728%. First build
16979224669

Pull #2456

github

web-flow
Merge 30049dfa7 into aaf3e36ad
Pull Request #2456: feat: basic BoolBuffer / BoolBufferMut

68 of 1065 new or added lines in 82 files covered. (6.38%)

8616 of 36312 relevant lines covered (23.73%)

146.37 hits per line

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

0.0
/vortex-array/src/arrays/bool/ops.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use vortex_error::VortexResult;
5
use vortex_scalar::Scalar;
6

7
use crate::arrays::{BoolArray, BoolVTable};
8
use crate::vtable::{OperationsVTable, ValidityHelper};
9
use crate::{ArrayRef, IntoArray};
10

11
impl OperationsVTable<BoolVTable> for BoolVTable {
12
    fn slice(array: &BoolArray, start: usize, stop: usize) -> VortexResult<ArrayRef> {
×
13
        Ok(BoolArray::new(
×
NEW
14
            array.bit_buffer().slice(start, stop - start),
×
15
            array.validity().slice(start, stop)?,
×
16
        )
17
        .into_array())
×
18
    }
×
19

20
    fn scalar_at(array: &BoolArray, index: usize) -> VortexResult<Scalar> {
×
21
        Ok(Scalar::bool(
×
NEW
22
            array.bit_buffer().value(index),
×
23
            array.dtype().nullability(),
×
24
        ))
×
25
    }
×
26
}
27

28
#[cfg(test)]
29
mod tests {
30
    use super::*;
31
    use crate::ToCanonical;
32

33
    #[test]
34
    fn test_slice_large() {
35
        let arr = BoolArray::from_iter(std::iter::repeat_n(Some(true), 100));
36
        let sliced_arr = arr.slice(8, 16).unwrap().to_bool().unwrap();
37
        assert_eq!(sliced_arr.len(), 8);
38
        assert_eq!(sliced_arr.bit_buffer().len(), 8);
39
        assert_eq!(sliced_arr.bit_buffer().offset(), 0);
40
    }
41

42
    #[test]
43
    fn test_slice() {
44
        let arr = BoolArray::from_iter([Some(true), Some(true), None, Some(false), None]);
45
        let sliced_arr = arr.slice(1, 4).unwrap().to_bool().unwrap();
46

47
        assert_eq!(sliced_arr.len(), 3);
48

49
        let s = sliced_arr.scalar_at(0).unwrap();
50
        assert_eq!(s.as_bool().value(), Some(true));
51

52
        let s = sliced_arr.scalar_at(1).unwrap();
53
        assert!(!sliced_arr.is_valid(1).unwrap());
54
        assert!(s.is_null());
55

56
        let s = sliced_arr.scalar_at(2).unwrap();
57
        assert_eq!(s.as_bool().value(), Some(false));
58
    }
59
}
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