Applies a binary [`Datum`] comparison operator `op` to `lhs` and `rhs`
(
op: Operator,
lhs: &ColumnarValue,
rhs: &ColumnarValue,
)
| 57 | |
| 58 | /// Applies a binary [`Datum`] comparison operator `op` to `lhs` and `rhs` |
| 59 | pub fn apply_cmp( |
| 60 | op: Operator, |
| 61 | lhs: &ColumnarValue, |
| 62 | rhs: &ColumnarValue, |
| 63 | ) -> Result<ColumnarValue> { |
| 64 | if lhs.data_type().is_nested() { |
| 65 | apply_cmp_for_nested(op, lhs, rhs) |
| 66 | } else { |
| 67 | let f = match op { |
| 68 | Operator::Eq => eq, |
| 69 | Operator::NotEq => neq, |
| 70 | Operator::Lt => lt, |
| 71 | Operator::LtEq => lt_eq, |
| 72 | Operator::Gt => gt, |
| 73 | Operator::GtEq => gt_eq, |
| 74 | Operator::IsDistinctFrom => distinct, |
| 75 | Operator::IsNotDistinctFrom => not_distinct, |
| 76 | |
| 77 | Operator::LikeMatch => like, |
| 78 | Operator::ILikeMatch => ilike, |
| 79 | Operator::NotLikeMatch => nlike, |
| 80 | Operator::NotILikeMatch => nilike, |
| 81 | |
| 82 | _ => { |
| 83 | return internal_err!("Invalid compare operator: {}", op); |
| 84 | } |
| 85 | }; |
| 86 | |
| 87 | apply(lhs, rhs, |l, r| Ok(Arc::new(f(l, r)?))) |
| 88 | } |
| 89 | } |
| 90 | |
| 91 | /// Applies a binary [`Datum`] comparison operator `op` to `lhs` and `rhs` for nested type like |
| 92 | /// List, FixedSizeList, LargeList, Struct, Union, Map, or a dictionary of a nested type |