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

Method add_checked

datafusion/common/src/scalar/mod.rs:2413–2425  ·  view source on GitHub ↗

Checked addition of `ScalarValue` NB: operating on `ScalarValue` directly is not efficient, performance sensitive code should operate on Arrays directly, using vectorized array kernels

(&self, other: T)

Source from the content-addressed store, hash-verified

2411 /// NB: operating on `ScalarValue` directly is not efficient, performance sensitive code
2412 /// should operate on Arrays directly, using vectorized array kernels
2413 pub fn add_checked<T: Borrow<ScalarValue>>(&self, other: T) -> Result<ScalarValue> {
2414 let other = other.borrow();
2415 if Self::can_use_direct_add(self, other) {
2416 let mut result = self.clone();
2417 if result.try_add_checked_in_place(other)? {
2418 return Ok(result);
2419 }
2420 debug_assert!(false, "fast-path eligibility drifted from implementation");
2421 }
2422
2423 let r = add(&self.to_scalar()?, &other.to_scalar()?)?;
2424 Self::try_from_array(r.as_ref(), 0)
2425 }
2426
2427 /// Wrapping subtraction of `ScalarValue`
2428 ///

Callers 15

add_boundsFunction · 0.80
meanMethod · 0.80
medianMethod · 0.80
combine_bernoullisFunction · 0.80
combine_gaussiansFunction · 0.80
compute_meanFunction · 0.80
compute_medianFunction · 0.80
compute_varianceFunction · 0.80
round_decimalFunction · 0.80
decimal_preimage_boundsFunction · 0.80
round_decimalFunction · 0.80

Calls 5

addFunction · 0.85
to_scalarMethod · 0.80
cloneMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected