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

vortex-data / vortex / 16935267080

13 Aug 2025 11:00AM UTC coverage: 24.312% (-63.3%) from 87.658%
16935267080

Pull #4226

github

web-flow
Merge 81b48c7fb into baa6ea202
Pull Request #4226: Support converting TimestampTZ to and from duckdb

0 of 2 new or added lines in 1 file covered. (0.0%)

20666 existing lines in 469 files now uncovered.

8726 of 35892 relevant lines covered (24.31%)

147.74 hits per line

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

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

4
use itertools::Itertools;
5
use vortex_buffer::ByteBuffer;
6
use vortex_dtype::DType;
7
use vortex_error::{VortexExpect, VortexResult, vortex_bail};
8

9
use super::StructEncoding;
10
use crate::arrays::{StructArray, StructVTable};
11
use crate::serde::ArrayChildren;
12
use crate::validity::Validity;
13
use crate::vtable::{SerdeVTable, ValidityHelper, VisitorVTable};
14
use crate::{ArrayBufferVisitor, ArrayChildVisitor, EmptyMetadata};
15

16
impl SerdeVTable<StructVTable> for StructVTable {
17
    type Metadata = EmptyMetadata;
18

19
    fn metadata(_array: &StructArray) -> VortexResult<Option<Self::Metadata>> {
8✔
20
        Ok(Some(EmptyMetadata))
8✔
21
    }
8✔
22

UNCOV
23
    fn build(
×
UNCOV
24
        _encoding: &StructEncoding,
×
UNCOV
25
        dtype: &DType,
×
UNCOV
26
        len: usize,
×
UNCOV
27
        _metadata: &Self::Metadata,
×
UNCOV
28
        _buffers: &[ByteBuffer],
×
UNCOV
29
        children: &dyn ArrayChildren,
×
UNCOV
30
    ) -> VortexResult<StructArray> {
×
UNCOV
31
        let DType::Struct(struct_dtype, nullability) = dtype else {
×
32
            vortex_bail!("Expected struct dtype, found {:?}", dtype)
×
33
        };
34

UNCOV
35
        let (validity, non_data_children) = if children.len() == struct_dtype.nfields() {
×
UNCOV
36
            (Validity::from(*nullability), 0_usize)
×
UNCOV
37
        } else if children.len() == struct_dtype.nfields() + 1 {
×
38
            // Validity is the first child if it exists.
UNCOV
39
            let validity = children.get(0, &Validity::DTYPE, len)?;
×
UNCOV
40
            (Validity::Array(validity), 1_usize)
×
41
        } else {
42
            vortex_bail!(
×
43
                "Expected {} or {} children, found {}",
×
44
                struct_dtype.nfields(),
×
45
                struct_dtype.nfields() + 1,
×
46
                children.len()
×
47
            );
48
        };
49

UNCOV
50
        let children = (0..struct_dtype.nfields())
×
UNCOV
51
            .map(|i| {
×
UNCOV
52
                let child_dtype = struct_dtype
×
UNCOV
53
                    .field_by_index(i)
×
UNCOV
54
                    .vortex_expect("no out of bounds");
×
UNCOV
55
                children.get(non_data_children + i, &child_dtype, len)
×
UNCOV
56
            })
×
UNCOV
57
            .try_collect()?;
×
58

UNCOV
59
        StructArray::try_new_with_dtype(children, struct_dtype.clone(), len, validity)
×
UNCOV
60
    }
×
61
}
62

63
impl VisitorVTable<StructVTable> for StructVTable {
64
    fn visit_buffers(_array: &StructArray, _visitor: &mut dyn ArrayBufferVisitor) {}
12✔
65

66
    fn visit_children(array: &StructArray, visitor: &mut dyn ArrayChildVisitor) {
16✔
67
        visitor.visit_validity(array.validity(), array.len());
16✔
68
        for (idx, name) in array.names().iter().enumerate() {
104✔
69
            visitor.visit_child(name.as_ref(), &array.fields()[idx]);
104✔
70
        }
104✔
71
    }
16✔
72
}
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