vortex_fsst/compute/
mod.rs

1mod compare;
2mod filter;
3
4use vortex_array::arrays::VarBinVTable;
5use vortex_array::compute::{TakeKernel, TakeKernelAdapter, fill_null, take};
6use vortex_array::{Array, ArrayRef, IntoArray, register_kernel};
7use vortex_error::VortexResult;
8use vortex_scalar::{Scalar, ScalarValue};
9
10use crate::{FSSTArray, FSSTVTable};
11
12impl TakeKernel for FSSTVTable {
13    // Take on an FSSTArray is a simple take on the codes array.
14    fn take(&self, array: &FSSTArray, indices: &dyn Array) -> VortexResult<ArrayRef> {
15        Ok(FSSTArray::try_new(
16            array.dtype().clone(),
17            array.symbols().clone(),
18            array.symbol_lengths().clone(),
19            take(array.codes().as_ref(), indices)?
20                .as_::<VarBinVTable>()
21                .clone(),
22            fill_null(
23                &take(array.uncompressed_lengths(), indices)?,
24                &Scalar::new(
25                    array.uncompressed_lengths_dtype().clone(),
26                    ScalarValue::from(0),
27                ),
28            )?,
29        )?
30        .into_array())
31    }
32}
33
34register_kernel!(TakeKernelAdapter(FSSTVTable).lift());