vortex_array/compute/
take_from.rs

1use vortex_error::{VortexExpect, VortexResult};
2
3use crate::encoding::Encoding;
4use crate::{Array, ArrayRef};
5
6pub trait TakeFromFn<A> {
7    fn take_from(&self, indices: A, array: &dyn Array) -> VortexResult<Option<ArrayRef>>;
8}
9
10impl<E: Encoding> TakeFromFn<&dyn Array> for E
11where
12    E: for<'a> TakeFromFn<&'a E::Array>,
13{
14    fn take_from(&self, indices: &dyn Array, array: &dyn Array) -> VortexResult<Option<ArrayRef>> {
15        let indices = indices
16            .as_any()
17            .downcast_ref::<E::Array>()
18            .vortex_expect("Failed to downcast array");
19
20        TakeFromFn::take_from(self, indices, array)
21    }
22}