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

Method partial_cmp

datafusion/expr/src/udf.rs:94–119  ·  view source on GitHub ↗
(&self, other: &Self)

Source from the content-addressed store, hash-verified

92
93impl PartialOrd for ScalarUDF {
94 fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
95 let mut cmp = self.name().cmp(other.name());
96 if cmp == Ordering::Equal {
97 cmp = self.signature().partial_cmp(other.signature())?;
98 }
99 if cmp == Ordering::Equal {
100 cmp = self.aliases().partial_cmp(other.aliases())?;
101 }
102 // Contract for PartialOrd and PartialEq consistency requires that
103 // a == b if and only if partial_cmp(a, b) == Some(Equal).
104 if cmp == Ordering::Equal && self != other {
105 // Functions may have other properties besides name and signature
106 // that differentiate two instances (e.g. type, or arbitrary parameters).
107 // We cannot return Some(Equal) in such case.
108 return None;
109 }
110 debug_assert!(
111 cmp == Ordering::Equal || self != other,
112 "Detected incorrect implementation of PartialEq when comparing functions: '{}' and '{}'. \
113 The functions compare as equal, but they are not equal based on general properties that \
114 the PartialOrd implementation observes,",
115 self.name(),
116 other.name()
117 );
118 Some(cmp)
119 }
120}
121
122impl Eq for ScalarUDF {}

Callers

nothing calls this directly

Calls 4

cmpMethod · 0.45
nameMethod · 0.45
signatureMethod · 0.45
aliasesMethod · 0.45

Tested by

no test coverage detected