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

Method contains

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

Decide if this interval is a superset of, overlaps with, or disjoint with `other` by returning `[true, true]`, `[false, true]` or `[false, false]` respectively. If the two intervals have different data types, both are coerced to a common comparison type via [`comparison_coercion`] before checking containment.

(&self, other: T)

Source from the content-addressed store, hash-verified

744 /// common comparison type via [`comparison_coercion`] before checking
745 /// containment.
746 pub fn contains<T: Borrow<Self>>(&self, other: T) -> Result<Self> {
747 let rhs = other.borrow();
748 let (lhs_owned, rhs_owned) = coerce_for_comparison(self, rhs)?;
749 let lhs = lhs_owned.as_ref().unwrap_or(self);
750 let rhs = rhs_owned.as_ref().unwrap_or(rhs);
751
752 match lhs.intersect(rhs)? {
753 Some(intersection) => {
754 if &intersection == rhs {
755 Ok(Self::TRUE)
756 } else {
757 Ok(Self::TRUE_OR_FALSE)
758 }
759 }
760 None => Ok(Self::FALSE),
761 }
762 }
763
764 /// Decide if this interval is a superset of `other`. If argument `strict`
765 /// is `true`, only returns `true` if this interval is a strict superset.

Callers 15

get_exprs_except_skippedFunction · 0.45
exclude_using_columnsFunction · 0.45
generate_sort_keyFunction · 0.45
find_exprs_in_exprsFunction · 0.45
find_exprs_in_exprFunction · 0.45
buildMethod · 0.45
distinct_exprMethod · 0.45
all_out_ref_exprsMethod · 0.45
is_scalarMethod · 0.45
check_subquery_exprFunction · 0.45
add_missing_columnsMethod · 0.45

Calls 5

coerce_for_comparisonFunction · 0.85
as_refMethod · 0.45
intersectMethod · 0.45
valuesMethod · 0.45
mapMethod · 0.45

Tested by

no test coverage detected