use vortex_array::array::ConstantArray;
use vortex_array::compute::{compare, take, CompareFn, Operator};
use vortex_array::ArrayData;
use vortex_error::VortexResult;
use crate::{DictArray, DictEncoding};
impl CompareFn<DictArray> for DictEncoding {
fn compare(
&self,
lhs: &DictArray,
rhs: &ArrayData,
operator: Operator,
) -> VortexResult<Option<ArrayData>> {
if let Some(const_scalar) = rhs.as_constant() {
let compare_result = compare(
lhs.values(),
ConstantArray::new(const_scalar, lhs.values().len()),
operator,
)?;
return take(compare_result, lhs.codes()).map(Some);
}
Ok(None)
}
}