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

Method sub

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

Subtract the given interval (`other`) from this interval. Say we have intervals `[a1, b1]` and `[a2, b2]`, then their difference is `[a1 - b2, b1 - a2]`. Note that this represents all possible values the difference can take if one can choose single values arbitrarily from each of the operands.

(&self, other: T)

Source from the content-addressed store, hash-verified

793 /// difference can take if one can choose single values arbitrarily from
794 /// each of the operands.
795 pub fn sub<T: Borrow<Interval>>(&self, other: T) -> Result<Self> {
796 let rhs = other.borrow();
797 let dt =
798 BinaryTypeCoercer::new(&self.data_type(), &Operator::Minus, &rhs.data_type())
799 .get_result_type()?;
800
801 Ok(Self::new(
802 sub_bounds::<false>(&dt, &self.lower, &rhs.upper),
803 sub_bounds::<true>(&dt, &self.upper, &rhs.lower),
804 ))
805 }
806
807 /// Multiply the given interval (`other`) with this interval. Say we have
808 /// intervals `[a1, b1]` and `[a2, b2]`, then their product is `[min(a1 * a2,

Callers 2

apply_operatorFunction · 0.45
test_subFunction · 0.45

Calls 3

newFunction · 0.85
get_result_typeMethod · 0.80
data_typeMethod · 0.45

Tested by 1

test_subFunction · 0.36