polars_compute/comparisons/
utf8.rs

1use arrow::array::Utf8Array;
2use arrow::bitmap::Bitmap;
3use arrow::types::Offset;
4
5use super::{TotalEqKernel, TotalOrdKernel};
6
7impl<O: Offset> TotalEqKernel for Utf8Array<O> {
8    type Scalar = str;
9
10    fn tot_eq_kernel(&self, other: &Self) -> Bitmap {
11        self.to_binary().tot_eq_kernel(&other.to_binary())
12    }
13
14    fn tot_ne_kernel(&self, other: &Self) -> Bitmap {
15        self.to_binary().tot_ne_kernel(&other.to_binary())
16    }
17
18    fn tot_eq_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
19        self.to_binary().tot_eq_kernel_broadcast(other.as_bytes())
20    }
21
22    fn tot_ne_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
23        self.to_binary().tot_ne_kernel_broadcast(other.as_bytes())
24    }
25}
26
27impl<O: Offset> TotalOrdKernel for Utf8Array<O> {
28    type Scalar = str;
29
30    fn tot_lt_kernel(&self, other: &Self) -> Bitmap {
31        self.to_binary().tot_lt_kernel(&other.to_binary())
32    }
33
34    fn tot_le_kernel(&self, other: &Self) -> Bitmap {
35        self.to_binary().tot_le_kernel(&other.to_binary())
36    }
37
38    fn tot_lt_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
39        self.to_binary().tot_lt_kernel_broadcast(other.as_bytes())
40    }
41
42    fn tot_le_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
43        self.to_binary().tot_le_kernel_broadcast(other.as_bytes())
44    }
45
46    fn tot_gt_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
47        self.to_binary().tot_gt_kernel_broadcast(other.as_bytes())
48    }
49
50    fn tot_ge_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
51        self.to_binary().tot_ge_kernel_broadcast(other.as_bytes())
52    }
53}