• 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/primitive/compute/between.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use arrow_buffer::BooleanBuffer;
5
use vortex_dtype::{NativePType, Nullability, match_each_native_ptype};
6
use vortex_error::VortexResult;
7

8
use crate::arrays::{BoolArray, PrimitiveArray, PrimitiveVTable};
9
use crate::compute::{BetweenKernel, BetweenKernelAdapter, BetweenOptions, StrictComparison};
10
use crate::vtable::ValidityHelper;
11
use crate::{Array, ArrayRef, IntoArray, register_kernel};
12

13
impl BetweenKernel for PrimitiveVTable {
UNCOV
14
    fn between(
×
UNCOV
15
        &self,
×
UNCOV
16
        arr: &PrimitiveArray,
×
UNCOV
17
        lower: &dyn Array,
×
UNCOV
18
        upper: &dyn Array,
×
UNCOV
19
        options: &BetweenOptions,
×
UNCOV
20
    ) -> VortexResult<Option<ArrayRef>> {
×
UNCOV
21
        let (Some(lower), Some(upper)) = (lower.as_constant(), upper.as_constant()) else {
×
UNCOV
22
            return Ok(None);
×
23
        };
24

25
        // Note, we know that have checked before that the lower and upper bounds are not constant
26
        // null values
27

UNCOV
28
        let nullability =
×
UNCOV
29
            arr.dtype.nullability() | lower.dtype().nullability() | upper.dtype().nullability();
×
30

UNCOV
31
        Ok(Some(match_each_native_ptype!(arr.ptype(), |P| {
×
32
            between_impl::<P>(
×
33
                arr,
×
34
                P::try_from(lower)?,
×
35
                P::try_from(upper)?,
×
36
                nullability,
×
37
                options,
×
38
            )
39
        })))
UNCOV
40
    }
×
41
}
42

43
register_kernel!(BetweenKernelAdapter(PrimitiveVTable).lift());
44

UNCOV
45
fn between_impl<T: NativePType + Copy>(
×
UNCOV
46
    arr: &PrimitiveArray,
×
UNCOV
47
    lower: T,
×
UNCOV
48
    upper: T,
×
UNCOV
49
    nullability: Nullability,
×
UNCOV
50
    options: &BetweenOptions,
×
UNCOV
51
) -> ArrayRef {
×
UNCOV
52
    match (options.lower_strict, options.upper_strict) {
×
53
        // Note: these comparisons are explicitly passed in to allow function impl inlining
UNCOV
54
        (StrictComparison::Strict, StrictComparison::Strict) => between_impl_(
×
UNCOV
55
            arr,
×
UNCOV
56
            lower,
×
UNCOV
57
            NativePType::is_lt,
×
UNCOV
58
            upper,
×
UNCOV
59
            NativePType::is_lt,
×
UNCOV
60
            nullability,
×
UNCOV
61
        ),
×
UNCOV
62
        (StrictComparison::Strict, StrictComparison::NonStrict) => between_impl_(
×
UNCOV
63
            arr,
×
UNCOV
64
            lower,
×
65
            NativePType::is_lt,
UNCOV
66
            upper,
×
67
            NativePType::is_le,
UNCOV
68
            nullability,
×
69
        ),
UNCOV
70
        (StrictComparison::NonStrict, StrictComparison::Strict) => between_impl_(
×
UNCOV
71
            arr,
×
UNCOV
72
            lower,
×
73
            NativePType::is_le,
UNCOV
74
            upper,
×
75
            NativePType::is_lt,
UNCOV
76
            nullability,
×
77
        ),
UNCOV
78
        (StrictComparison::NonStrict, StrictComparison::NonStrict) => between_impl_(
×
UNCOV
79
            arr,
×
UNCOV
80
            lower,
×
81
            NativePType::is_le,
UNCOV
82
            upper,
×
83
            NativePType::is_le,
UNCOV
84
            nullability,
×
85
        ),
86
    }
UNCOV
87
}
×
88

UNCOV
89
fn between_impl_<T>(
×
UNCOV
90
    arr: &PrimitiveArray,
×
UNCOV
91
    lower: T,
×
UNCOV
92
    lower_fn: impl Fn(T, T) -> bool,
×
UNCOV
93
    upper: T,
×
UNCOV
94
    upper_fn: impl Fn(T, T) -> bool,
×
UNCOV
95
    nullability: Nullability,
×
UNCOV
96
) -> ArrayRef
×
UNCOV
97
where
×
UNCOV
98
    T: NativePType + Copy,
×
99
{
UNCOV
100
    let slice = arr.as_slice::<T>();
×
UNCOV
101
    BoolArray::new(
×
UNCOV
102
        BooleanBuffer::collect_bool(slice.len(), |idx| {
×
103
            // We only iterate upto arr len and |arr| == |slice|.
UNCOV
104
            let i = unsafe { *slice.get_unchecked(idx) };
×
UNCOV
105
            lower_fn(lower, i) & upper_fn(i, upper)
×
UNCOV
106
        }),
×
UNCOV
107
        arr.validity().clone().union_nullability(nullability),
×
108
    )
UNCOV
109
    .into_array()
×
UNCOV
110
}
×
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