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

Method gt_eq

datafusion/expr-common/src/interval_arithmetic.rs:499–524  ·  view source on GitHub ↗

Decide if this interval is certainly greater than or equal to, possibly greater than or equal to, or can't be greater than or equal to `other` by returning `[true, true]`, `[false, true]` or `[false, false]` respectively. NOTE: This function only works with intervals of the same data type. Attempting to compare intervals of different data types will lead to an error.

(&self, other: T)

Source from the content-addressed store, hash-verified

497 /// Attempting to compare intervals of different data types will lead
498 /// to an error.
499 pub fn gt_eq<T: Borrow<Self>>(&self, other: T) -> Result<Self> {
500 let rhs = other.borrow();
501 let lhs_type = self.data_type();
502 let rhs_type = rhs.data_type();
503 assert_eq_or_internal_err!(
504 lhs_type,
505 rhs_type,
506 "Only intervals with the same data type are comparable, lhs:{}, rhs:{}",
507 self.data_type(),
508 rhs.data_type()
509 );
510 if !(self.lower.is_null() || rhs.upper.is_null()) && self.lower >= rhs.upper {
511 // Values in this interval are certainly greater than or equal to
512 // those in the given interval.
513 Ok(Self::TRUE)
514 } else if !(self.upper.is_null() || rhs.lower.is_null())
515 && (self.upper < rhs.lower)
516 {
517 // Values in this interval are certainly less than those in the
518 // given interval.
519 Ok(Self::FALSE)
520 } else {
521 // All outcomes are possible.
522 Ok(Self::TRUE_OR_FALSE)
523 }
524 }
525
526 /// Decide if this interval is certainly less than, possibly less than, or
527 /// can't be less than `other` by returning `[true, true]`, `[false, true]`

Callers 2

lt_eqMethod · 0.45
apply_operatorFunction · 0.45

Calls 2

data_typeMethod · 0.45
is_nullMethod · 0.45

Tested by

no test coverage detected