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

Method add

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

Add the given interval (`other`) to this interval. Say we have intervals `[a1, b1]` and `[a2, b2]`, then their sum is `[a1 + a2, b1 + b2]`. Note that this represents all possible values the sum 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

776 /// that this represents all possible values the sum can take if one can
777 /// choose single values arbitrarily from each of the operands.
778 pub fn add<T: Borrow<Self>>(&self, other: T) -> Result<Self> {
779 let rhs = other.borrow();
780 let dt =
781 BinaryTypeCoercer::new(&self.data_type(), &Operator::Plus, &rhs.data_type())
782 .get_result_type()?;
783
784 Ok(Self::new(
785 add_bounds::<false>(&dt, &self.lower, &rhs.lower),
786 add_bounds::<true>(&dt, &self.upper, &rhs.upper),
787 ))
788 }
789
790 /// Subtract the given interval (`other`) from this interval. Say we have
791 /// intervals `[a1, b1]` and `[a2, b2]`, then their difference is

Callers 2

apply_operatorFunction · 0.45
test_addFunction · 0.45

Calls 3

newFunction · 0.85
get_result_typeMethod · 0.80
data_typeMethod · 0.45

Tested by 1

test_addFunction · 0.36