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

Function apply_cmp

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

Applies a binary [`Datum`] comparison operator `op` to `lhs` and `rhs`

(
    op: Operator,
    lhs: &ColumnarValue,
    rhs: &ColumnarValue,
)

Source from the content-addressed store, hash-verified

57
58/// Applies a binary [`Datum`] comparison operator `op` to `lhs` and `rhs`
59pub 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

Callers 2

evaluateMethod · 0.85
evaluateMethod · 0.85

Calls 4

apply_cmp_for_nestedFunction · 0.85
applyFunction · 0.85
newFunction · 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…