polars_compute/comparisons/
utf8.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
use arrow::array::Utf8Array;
use arrow::bitmap::Bitmap;
use arrow::types::Offset;

use super::{TotalEqKernel, TotalOrdKernel};

impl<O: Offset> TotalEqKernel for Utf8Array<O> {
    type Scalar = str;

    fn tot_eq_kernel(&self, other: &Self) -> Bitmap {
        self.to_binary().tot_eq_kernel(&other.to_binary())
    }

    fn tot_ne_kernel(&self, other: &Self) -> Bitmap {
        self.to_binary().tot_ne_kernel(&other.to_binary())
    }

    fn tot_eq_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
        self.to_binary().tot_eq_kernel_broadcast(other.as_bytes())
    }

    fn tot_ne_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
        self.to_binary().tot_ne_kernel_broadcast(other.as_bytes())
    }
}

impl<O: Offset> TotalOrdKernel for Utf8Array<O> {
    type Scalar = str;

    fn tot_lt_kernel(&self, other: &Self) -> Bitmap {
        self.to_binary().tot_lt_kernel(&other.to_binary())
    }

    fn tot_le_kernel(&self, other: &Self) -> Bitmap {
        self.to_binary().tot_le_kernel(&other.to_binary())
    }

    fn tot_lt_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
        self.to_binary().tot_lt_kernel_broadcast(other.as_bytes())
    }

    fn tot_le_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
        self.to_binary().tot_le_kernel_broadcast(other.as_bytes())
    }

    fn tot_gt_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
        self.to_binary().tot_gt_kernel_broadcast(other.as_bytes())
    }

    fn tot_ge_kernel_broadcast(&self, other: &Self::Scalar) -> Bitmap {
        self.to_binary().tot_ge_kernel_broadcast(other.as_bytes())
    }
}