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

vortex-data / vortex / 16080477585

04 Jul 2025 08:22PM UTC coverage: 78.059% (-0.004%) from 78.063%
16080477585

push

github

web-flow
chore(deps): update all patch updates (patch) (#3774)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [gradle](https://gradle.org)
([source](https://redirect.github.com/gradle/gradle)) | | patch |
`8.14.2` -> `8.14.3` |
| [tokio](https://tokio.rs)
([source](https://redirect.github.com/tokio-rs/tokio)) |
workspace.dependencies | patch | `1.46.0` -> `1.46.1` |

---

### Release Notes

<details>
<summary>gradle/gradle (gradle)</summary>

###
[`v8.14.3`](https://redirect.github.com/gradle/gradle/releases/tag/v8.14.3):
8.14.3

[Compare
Source](https://redirect.github.com/gradle/gradle/compare/v8.14.2...v8.14.3)

The Gradle team is excited to announce Gradle 8.14.3.

This is a patch release for 8.14. We recommend using 8.14.3 instead of
8.14.

Here are the highlights of this release:

- Java 24 support
- GraalVM Native Image toolchain selection
- Enhancements to test reporting
- Build Authoring improvements

[Read the Release
Notes](https://docs.gradle.org/8.14.3/release-notes.html)

We would like to thank the following community members for their
contributions to this release of Gradle:
[Aurimas](https://redirect.github.com/liutikas),
[Ben Bader](https://redirect.github.com/benjamin-bader),
[Björn Kautler](https://redirect.github.com/Vampire),
[chandre92](https://redirect.github.com/chandre92),
[Daniel Hammer](https://redirect.github.com/dlehammer),
[Danish Nawab](https://redirect.github.com/danishnawab),
[Florian Dreier](https://redirect.github.com/DreierF),
[Ivy Chen](https://redirect.github.com/Mengmeiivy),
[Jendrik Johannes](https://redirect.github.com/jjohannes),
[jimmy1995-gu](https://redirect.github.com/jimmy1995-gu),
[Madalin Valceleanu](https://redirect.github.com/vmadalin),
[Na Minhyeok](https://redirect.github.com/NaMinhyeok).

#### Upgrade instructions

Switch your build to use Gradle 8.14.3 by updating your wrapper:

```
./gradlew wrapper --gradle-version=8.14.3 && ./gradlew wrapper
```

See t... (continued)

43845 of 56169 relevant lines covered (78.06%)

55272.13 hits per line

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

72.86
/vortex-array/src/compute/invert.rs
1
// SPDX-License-Identifier: Apache-2.0
2
// SPDX-FileCopyrightText: Copyright the Vortex contributors
3

4
use std::sync::LazyLock;
5

6
use arcref::ArcRef;
7
use vortex_dtype::DType;
8
use vortex_error::{VortexError, VortexResult, vortex_bail, vortex_err, vortex_panic};
9

10
use crate::compute::{ComputeFn, ComputeFnVTable, InvocationArgs, Kernel, Output, UnaryArgs};
11
use crate::vtable::VTable;
12
use crate::{Array, ArrayRef, IntoArray, ToCanonical};
13

14
/// Logically invert a boolean array, preserving its validity.
15
pub fn invert(array: &dyn Array) -> VortexResult<ArrayRef> {
113✔
16
    INVERT_FN
113✔
17
        .invoke(&InvocationArgs {
113✔
18
            inputs: &[array.into()],
113✔
19
            options: &(),
113✔
20
        })?
113✔
21
        .unwrap_array()
113✔
22
}
113✔
23

24
struct Invert;
25

26
impl ComputeFnVTable for Invert {
27
    fn invoke(
113✔
28
        &self,
113✔
29
        args: &InvocationArgs,
113✔
30
        kernels: &[ArcRef<dyn Kernel>],
113✔
31
    ) -> VortexResult<Output> {
113✔
32
        let UnaryArgs { array, .. } = UnaryArgs::<()>::try_from(args)?;
113✔
33

34
        for kernel in kernels {
113✔
35
            if let Some(output) = kernel.invoke(args)? {
113✔
36
                return Ok(output);
113✔
37
            }
×
38
        }
39
        if let Some(output) = array.invoke(&INVERT_FN, args)? {
×
40
            return Ok(output);
×
41
        }
×
42

×
43
        // Otherwise, we canonicalize into a boolean array and invert.
×
44
        log::debug!(
×
45
            "No invert implementation found for encoding {}",
×
46
            array.encoding_id(),
×
47
        );
48
        if array.is_canonical() {
×
49
            vortex_panic!("Canonical bool array does not implement invert");
×
50
        }
×
51
        Ok(invert(&array.to_bool()?.into_array())?.into())
×
52
    }
113✔
53

54
    fn return_dtype(&self, args: &InvocationArgs) -> VortexResult<DType> {
113✔
55
        let UnaryArgs { array, .. } = UnaryArgs::<()>::try_from(args)?;
113✔
56

57
        if !matches!(array.dtype(), DType::Bool(..)) {
113✔
58
            vortex_bail!("Expected boolean array, got {}", array.dtype());
×
59
        }
113✔
60
        Ok(array.dtype().clone())
113✔
61
    }
113✔
62

63
    fn return_len(&self, args: &InvocationArgs) -> VortexResult<usize> {
113✔
64
        let UnaryArgs { array, .. } = UnaryArgs::<()>::try_from(args)?;
113✔
65
        Ok(array.len())
113✔
66
    }
113✔
67

68
    fn is_elementwise(&self) -> bool {
113✔
69
        true
113✔
70
    }
113✔
71
}
72

73
struct InvertArgs<'a> {
74
    array: &'a dyn Array,
75
}
76

77
impl<'a> TryFrom<&InvocationArgs<'a>> for InvertArgs<'a> {
78
    type Error = VortexError;
79

80
    fn try_from(value: &InvocationArgs<'a>) -> Result<Self, Self::Error> {
113✔
81
        if value.inputs.len() != 1 {
113✔
82
            vortex_bail!("Invert expects exactly one argument",);
×
83
        }
113✔
84
        let array = value.inputs[0]
113✔
85
            .array()
113✔
86
            .ok_or_else(|| vortex_err!("Invert expects an array argument"))?;
113✔
87
        Ok(InvertArgs { array })
113✔
88
    }
113✔
89
}
90

91
pub struct InvertKernelRef(ArcRef<dyn Kernel>);
92
inventory::collect!(InvertKernelRef);
93

94
pub trait InvertKernel: VTable {
95
    /// Logically invert a boolean array. Converts true -> false, false -> true, null -> null.
96
    fn invert(&self, array: &Self::Array) -> VortexResult<ArrayRef>;
97
}
98

99
#[derive(Debug)]
100
pub struct InvertKernelAdapter<V: VTable>(pub V);
101

102
impl<V: VTable + InvertKernel> InvertKernelAdapter<V> {
103
    pub const fn lift(&'static self) -> InvertKernelRef {
×
104
        InvertKernelRef(ArcRef::new_ref(self))
×
105
    }
×
106
}
107

108
impl<V: VTable + InvertKernel> Kernel for InvertKernelAdapter<V> {
109
    fn invoke(&self, args: &InvocationArgs) -> VortexResult<Option<Output>> {
113✔
110
        let args = InvertArgs::try_from(args)?;
113✔
111
        let Some(array) = args.array.as_opt::<V>() else {
113✔
112
            return Ok(None);
×
113
        };
114
        Ok(Some(V::invert(&self.0, array)?.into()))
113✔
115
    }
113✔
116
}
117

118
pub static INVERT_FN: LazyLock<ComputeFn> = LazyLock::new(|| {
112✔
119
    let compute = ComputeFn::new("invert".into(), ArcRef::new_ref(&Invert));
112✔
120
    for kernel in inventory::iter::<InvertKernelRef> {
522✔
121
        compute.register_kernel(kernel.0.clone());
410✔
122
    }
410✔
123
    compute
112✔
124
});
112✔
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