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

vortex-data / vortex / 16728097825

04 Aug 2025 04:00PM UTC coverage: 48.355% (-35.1%) from 83.429%
16728097825

Pull #4108

github

web-flow
Merge 1b2d27fd8 into 649ba9576
Pull Request #4108: perf[vortex-array]: use all_valid instead of `invalid_count() == 0`

1 of 1 new or added line in 1 file covered. (100.0%)

11596 existing lines in 378 files now uncovered.

18635 of 38538 relevant lines covered (48.35%)

151786.4 hits per line

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

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

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

8
use crate::arrays::{StructArray, StructVTable};
9
use crate::compute::{CastKernel, CastKernelAdapter, cast};
10
use crate::vtable::ValidityHelper;
11
use crate::{ArrayRef, IntoArray, register_kernel};
12

13
impl CastKernel for StructVTable {
UNCOV
14
    fn cast(&self, array: &StructArray, dtype: &DType) -> VortexResult<Option<ArrayRef>> {
×
UNCOV
15
        let Some(target_sdtype) = dtype.as_struct() else {
×
16
            return Ok(None);
×
17
        };
18

UNCOV
19
        let source_sdtype = array
×
UNCOV
20
            .dtype()
×
UNCOV
21
            .as_struct()
×
UNCOV
22
            .vortex_expect("struct array must have struct dtype");
×
23

UNCOV
24
        if target_sdtype.names() != source_sdtype.names() {
×
UNCOV
25
            vortex_bail!("cannot cast {} to {}", array.dtype(), dtype);
×
UNCOV
26
        }
×
27

UNCOV
28
        let validity = array
×
UNCOV
29
            .validity()
×
UNCOV
30
            .clone()
×
UNCOV
31
            .cast_nullability(dtype.nullability())?;
×
32

UNCOV
33
        StructArray::try_new(
×
UNCOV
34
            target_sdtype.names().clone(),
×
UNCOV
35
            array
×
UNCOV
36
                .fields()
×
UNCOV
37
                .iter()
×
UNCOV
38
                .zip_eq(target_sdtype.fields())
×
UNCOV
39
                .map(|(field, dtype)| cast(field, &dtype))
×
UNCOV
40
                .try_collect()?,
×
UNCOV
41
            array.len(),
×
UNCOV
42
            validity,
×
43
        )
UNCOV
44
        .map(|a| Some(a.into_array()))
×
UNCOV
45
    }
×
46
}
47

48
register_kernel!(CastKernelAdapter(StructVTable).lift());
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