• 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

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

4
use arrow_buffer::ArrowNativeType;
5
use itertools::Itertools as _;
6
use vortex_buffer::{Buffer, BufferMut};
7
use vortex_dtype::{DecimalDType, NativePType, match_each_integer_ptype};
8
use vortex_error::{VortexExpect as _, VortexResult, vortex_bail};
9
use vortex_scalar::{BigCast, NativeDecimalType, match_each_decimal_value_type};
10

11
use super::{DecimalArray, compatible_storage_type};
12
use crate::ToCanonical as _;
13
use crate::patches::Patches;
14
use crate::validity::Validity;
15
use crate::vtable::ValidityHelper;
16

17
impl DecimalArray {
18
    #[allow(clippy::cognitive_complexity)]
UNCOV
19
    pub fn patch(self, patches: &Patches) -> VortexResult<Self> {
×
UNCOV
20
        let offset = patches.offset();
×
UNCOV
21
        let patch_indices = patches.indices().to_primitive()?;
×
UNCOV
22
        let patch_values = patches.values().to_decimal()?;
×
23

UNCOV
24
        let patched_validity = self.validity().clone().patch(
×
UNCOV
25
            self.len(),
×
UNCOV
26
            offset,
×
UNCOV
27
            patch_indices.as_ref(),
×
UNCOV
28
            patch_values.validity(),
×
29
        )?;
×
UNCOV
30
        assert_eq!(self.decimal_dtype(), patch_values.decimal_dtype());
×
31

UNCOV
32
        match_each_integer_ptype!(patch_indices.ptype(), |I| {
×
33
            let patch_indices = patch_indices.as_slice::<I>();
×
34
            match_each_decimal_value_type!(patch_values.values_type(), |PatchDVT| {
×
35
                let patch_values = patch_values.buffer::<PatchDVT>();
×
36
                match_each_decimal_value_type!(self.values_type(), |ValuesDVT| {
×
37
                    let buffer = self.buffer::<ValuesDVT>().into_mut();
×
38
                    patch_typed(
×
39
                        buffer,
×
40
                        self.decimal_dtype(),
×
41
                        patch_indices,
×
42
                        offset,
×
43
                        patch_values,
×
44
                        patched_validity,
×
45
                    )
46
                })
47
            })
48
        })
UNCOV
49
    }
×
50
}
51

UNCOV
52
fn patch_typed<I, ValuesDVT, PatchDVT>(
×
UNCOV
53
    mut buffer: BufferMut<ValuesDVT>,
×
UNCOV
54
    decimal_dtype: DecimalDType,
×
UNCOV
55
    patch_indices: &[I],
×
UNCOV
56
    patch_indices_offset: usize,
×
UNCOV
57
    patch_values: Buffer<PatchDVT>,
×
UNCOV
58
    patched_validity: Validity,
×
UNCOV
59
) -> VortexResult<DecimalArray>
×
UNCOV
60
where
×
UNCOV
61
    I: NativePType + ArrowNativeType,
×
UNCOV
62
    PatchDVT: NativeDecimalType,
×
UNCOV
63
    ValuesDVT: NativeDecimalType,
×
64
{
UNCOV
65
    if !compatible_storage_type(ValuesDVT::VALUES_TYPE, decimal_dtype) {
×
66
        vortex_bail!(
×
67
            "patch_typed: {:?} cannot represent every value in {}.",
×
68
            ValuesDVT::VALUES_TYPE,
69
            decimal_dtype
70
        )
UNCOV
71
    }
×
72

UNCOV
73
    for (idx, value) in patch_indices.iter().zip_eq(patch_values.into_iter()) {
×
UNCOV
74
        buffer[idx.as_usize() - patch_indices_offset] = <ValuesDVT as BigCast>::from(value).vortex_expect(
×
UNCOV
75
            "values of a given DecimalDType are representable in all compatible NativeDecimalType",
×
UNCOV
76
        );
×
UNCOV
77
    }
×
78

UNCOV
79
    Ok(DecimalArray::new(
×
UNCOV
80
        buffer.freeze(),
×
UNCOV
81
        decimal_dtype,
×
UNCOV
82
        patched_validity,
×
UNCOV
83
    ))
×
UNCOV
84
}
×
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