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

vortex-data / vortex / 17073077835

19 Aug 2025 02:40PM UTC coverage: 24.083%. First build
17073077835

Pull #4177

github

web-flow
Merge b42e5758f into 431a8f2b5
Pull Request #4177: feat: ArrayOperations infallible, eager validation + new_unchecked

197 of 1455 new or added lines in 154 files covered. (13.54%)

8646 of 35901 relevant lines covered (24.08%)

142.28 hits per line

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

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

4
use vortex_buffer::{Alignment, ByteBuffer};
5
use vortex_dtype::DType;
6
use vortex_error::{VortexResult, vortex_bail, vortex_err};
7

8
use super::BoolArray;
9
use crate::arrays::BoolVTable;
10
use crate::serde::ArrayChildren;
11
use crate::validity::Validity;
12
use crate::vtable::{SerdeVTable, VTable, VisitorVTable};
13
use crate::{ArrayBufferVisitor, ArrayChildVisitor, ProstMetadata};
14

15
#[derive(prost::Message)]
16
pub struct BoolMetadata {
17
    // The offset in bits must be <8
18
    #[prost(uint32, tag = "1")]
19
    pub offset: u32,
20
}
21

22
impl SerdeVTable<BoolVTable> for BoolVTable {
23
    type Metadata = ProstMetadata<BoolMetadata>;
24

25
    fn metadata(array: &BoolArray) -> VortexResult<Option<Self::Metadata>> {
16✔
26
        let bit_offset = array.boolean_buffer().offset();
16✔
27
        let bit_offset = u32::try_from(bit_offset)
16✔
28
            .map_err(|_| vortex_err!("bit_offset {bit_offset} overflows u32"))?;
16✔
29
        Ok(Some(ProstMetadata(BoolMetadata { offset: bit_offset })))
16✔
30
    }
16✔
31

32
    fn build(
×
33
        _encoding: &<BoolVTable as VTable>::Encoding,
×
34
        dtype: &DType,
×
35
        len: usize,
×
36
        metadata: &BoolMetadata,
×
37
        buffers: &[ByteBuffer],
×
38
        children: &dyn ArrayChildren,
×
39
    ) -> VortexResult<BoolArray> {
×
40
        if buffers.len() != 1 {
×
41
            vortex_bail!("Expected 1 buffer, got {}", buffers.len());
×
42
        }
×
43

44
        let validity = if children.is_empty() {
×
45
            Validity::from(dtype.nullability())
×
46
        } else if children.len() == 1 {
×
47
            let validity = children.get(0, &Validity::DTYPE, len)?;
×
48
            Validity::Array(validity)
×
49
        } else {
50
            vortex_bail!("Expected 0 or 1 child, got {}", children.len());
×
51
        };
52

NEW
53
        BoolArray::try_new(buffers[0].clone(), metadata.offset as usize, len, validity)
×
54
    }
×
55
}
56

57
impl VisitorVTable<BoolVTable> for BoolVTable {
58
    fn visit_buffers(array: &BoolArray, visitor: &mut dyn ArrayBufferVisitor) {
24✔
59
        visitor.visit_buffer(&ByteBuffer::from_arrow_buffer(
24✔
60
            array.boolean_buffer().clone().into_inner(),
24✔
61
            Alignment::none(),
24✔
62
        ))
24✔
63
    }
24✔
64

65
    fn visit_children(array: &BoolArray, visitor: &mut dyn ArrayChildVisitor) {
32✔
66
        visitor.visit_validity(&array.validity, array.len());
32✔
67
    }
32✔
68
}
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