MCPcopy Create free account
hub / github.com/apache/datafusion / apply_cmp_for_nested

Function apply_cmp_for_nested

datafusion/physical-expr-common/src/datum.rs:93–119  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

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
93pub 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
122pub fn compare_with_eq(

Callers 1

apply_cmpFunction · 0.85

Calls 4

applyFunction · 0.85
newFunction · 0.85
compare_op_for_nestedFunction · 0.85
data_typeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…