vortex_compute/take/vector/
null.rs

1// SPDX-License-Identifier: Apache-2.0
2// SPDX-FileCopyrightText: Copyright the Vortex contributors
3
4use vortex_dtype::UnsignedPType;
5use vortex_vector::VectorOps;
6use vortex_vector::null::NullVector;
7use vortex_vector::primitive::PVector;
8
9use crate::take::Take;
10
11impl<I: UnsignedPType> Take<PVector<I>> for &NullVector {
12    type Output = NullVector;
13
14    fn take(self, indices: &PVector<I>) -> NullVector {
15        // NullVector is always all-null, so the result is just a new NullVector with the same
16        // length as the indices. We don't need to check index validity since the result is all-null
17        // regardless.
18        NullVector::new(indices.len())
19    }
20}
21
22impl<I: UnsignedPType> Take<[I]> for &NullVector {
23    type Output = NullVector;
24
25    fn take(self, indices: &[I]) -> NullVector {
26        // NullVector is always all-null, so the result is just a new NullVector with the same
27        // length as the indices.
28        NullVector::new(indices.len())
29    }
30}