vortex_compute/take/vector/
mod.rs1use vortex_dtype::UnsignedPType;
5use vortex_vector::Vector;
6use vortex_vector::match_each_unsigned_pvector;
7use vortex_vector::match_each_vector;
8use vortex_vector::primitive::PVector;
9use vortex_vector::primitive::PrimitiveVector;
10
11use crate::take::Take;
12
13mod binaryview;
14mod bool;
15mod decimal;
16
17pub use self::bool::default_take;
18pub use self::bool::optimized_take;
19mod dvector;
20mod fixed_size_list;
21mod listview;
22mod null;
23mod primitive;
24mod pvector;
25mod struct_;
26
27#[cfg(test)]
28mod tests;
29
30impl<I: UnsignedPType> Take<PVector<I>> for Vector {
31 type Output = Vector;
32
33 fn take(self, indices: &PVector<I>) -> Vector {
34 (&self).take(indices)
35 }
36}
37
38impl<I: UnsignedPType> Take<[I]> for Vector {
39 type Output = Vector;
40
41 fn take(self, indices: &[I]) -> Vector {
42 (&self).take(indices)
43 }
44}
45
46impl<I: UnsignedPType> Take<PVector<I>> for &Vector {
47 type Output = Vector;
48
49 fn take(self, indices: &PVector<I>) -> Vector {
50 match_each_vector!(self, |v| { v.take(indices).into() })
51 }
52}
53
54impl<I: UnsignedPType> Take<[I]> for &Vector {
55 type Output = Vector;
56
57 fn take(self, indices: &[I]) -> Vector {
58 match_each_vector!(self, |v| { v.take(indices).into() })
59 }
60}
61
62impl<T> Take<PrimitiveVector> for &T
63where
64 for<'a> &'a T: Take<PVector<u8>, Output = T>,
65 for<'a> &'a T: Take<PVector<u16>, Output = T>,
66 for<'a> &'a T: Take<PVector<u32>, Output = T>,
67 for<'a> &'a T: Take<PVector<u64>, Output = T>,
68{
69 type Output = T;
70
71 fn take(self, indices: &PrimitiveVector) -> T {
72 match_each_unsigned_pvector!(indices, |iv| { self.take(iv) })
73 }
74}
75
76impl Take<PrimitiveVector> for Vector {
77 type Output = Vector;
78
79 fn take(self, indices: &PrimitiveVector) -> Vector {
80 (&self).take(indices)
81 }
82}