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

Method partial_cmp

datafusion/expr/src/higher_order_function.rs:169–194  ·  view source on GitHub ↗
(&self, other: &Self)

Source from the content-addressed store, hash-verified

167
168impl PartialOrd for dyn HigherOrderUDFImpl {
169 fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
170 let mut cmp = self.name().cmp(other.name());
171 if cmp == Ordering::Equal {
172 cmp = self.signature().partial_cmp(other.signature())?;
173 }
174 if cmp == Ordering::Equal {
175 cmp = self.aliases().partial_cmp(other.aliases())?;
176 }
177 // Contract for PartialOrd and PartialEq consistency requires that
178 // a == b if and only if partial_cmp(a, b) == Some(Equal).
179 if cmp == Ordering::Equal && self != other {
180 // Functions may have other properties besides name and signature
181 // that differentiate two instances (e.g. type, or arbitrary parameters).
182 // We cannot return Some(Equal) in such case.
183 return None;
184 }
185 debug_assert!(
186 cmp == Ordering::Equal || self != other,
187 "Detected incorrect implementation of PartialEq when comparing functions: '{}' and '{}'. \
188 The functions compare as equal, but they are not equal based on general properties that \
189 the PartialOrd implementation observes,",
190 self.name(),
191 other.name()
192 );
193 Some(cmp)
194 }
195}
196
197impl Eq for dyn HigherOrderUDFImpl {}

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