Applies a binary [`Datum`] comparison operator `op` to `lhs` and `rhs` for nested type like List, FixedSizeList, LargeList, Struct, Union, Map, or a dictionary of a nested type
(
op: Operator,
lhs: &ColumnarValue,
rhs: &ColumnarValue,
)
| 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 |
| 93 | pub fn apply_cmp_for_nested( |
| 94 | op: Operator, |
| 95 | lhs: &ColumnarValue, |
| 96 | rhs: &ColumnarValue, |
| 97 | ) -> Result<ColumnarValue> { |
| 98 | let left_data_type = lhs.data_type(); |
| 99 | let right_data_type = rhs.data_type(); |
| 100 | |
| 101 | assert_or_internal_err!( |
| 102 | matches!( |
| 103 | op, |
| 104 | Operator::Eq |
| 105 | | Operator::NotEq |
| 106 | | Operator::Lt |
| 107 | | Operator::Gt |
| 108 | | Operator::LtEq |
| 109 | | Operator::GtEq |
| 110 | | Operator::IsDistinctFrom |
| 111 | | Operator::IsNotDistinctFrom |
| 112 | ) && left_data_type.equals_datatype(&right_data_type), |
| 113 | "invalid operator or data type mismatch for nested data, op {op} left {left_data_type}, right {right_data_type}", |
| 114 | ); |
| 115 | |
| 116 | apply(lhs, rhs, |l, r| { |
| 117 | Ok(Arc::new(compare_op_for_nested(op, l, r)?)) |
| 118 | }) |
| 119 | } |
| 120 | |
| 121 | /// Compare with eq with either nested or non-nested |
| 122 | pub fn compare_with_eq( |
no test coverage detected
searching dependent graphs…