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

vortex-data / vortex / 16538980973

26 Jul 2025 10:41AM UTC coverage: 81.786% (-0.003%) from 81.789%
16538980973

push

github

web-flow
chore(deps): update rust crate roaring to v0.11.2 (#4024)

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [roaring](https://redirect.github.com/RoaringBitmap/roaring-rs) |
workspace.dependencies | patch | `0.11.1` -> `0.11.2` |

---

### Release Notes

<details>
<summary>RoaringBitmap/roaring-rs (roaring)</summary>

###
[`v0.11.2`](https://redirect.github.com/RoaringBitmap/roaring-rs/releases/tag/v0.11.2)

[Compare
Source](https://redirect.github.com/RoaringBitmap/roaring-rs/compare/v0.11.1...v0.11.2)

#### What's Changed

- fix: change `package.rust-version` in `roaring/Cargo.toml` by
[@&#8203;lucascool12](https://redirect.github.com/lucascool12) in
[https://github.com/RoaringBitmap/roaring-rs/pull/333](https://redirect.github.com/RoaringBitmap/roaring-rs/pull/333)
- fix: clippy findings from updated msrv by
[@&#8203;Dr-Emann](https://redirect.github.com/Dr-Emann) in
[https://github.com/RoaringBitmap/roaring-rs/pull/336](https://redirect.github.com/RoaringBitmap/roaring-rs/pull/336)
- Fuzz iterators and fix bugs by
[@&#8203;Dr-Emann](https://redirect.github.com/Dr-Emann) in
[https://github.com/RoaringBitmap/roaring-rs/pull/335](https://redirect.github.com/RoaringBitmap/roaring-rs/pull/335)
- Bump roaring to v0.11.2 by
[@&#8203;Kerollmops](https://redirect.github.com/Kerollmops) in
[https://github.com/RoaringBitmap/roaring-rs/pull/337](https://redirect.github.com/RoaringBitmap/roaring-rs/pull/337)

**Full Changelog**:
https://github.com/RoaringBitmap/roaring-rs/compare/v0.11.1...v0.11.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

â™» **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, chec... (continued)

43209 of 52832 relevant lines covered (81.79%)

170561.31 hits per line

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

75.0
/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